Skip to content

dreamingblackcat/rb-stdlib-rest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

rb-stdlib-rest

This is a fun exercise of building a simple rest api web server using only ruby built-in libraries(core+stdlib).

Note:**It was created using ruby-2.1.5 . Tested on ruby-2.1.5 and ruby-2.3.0.

The stdlib libraries used are

  • minitest
  • json
  • webrick
  • minitest

Running the server

  • Clone the repo
  • cd into the repo
  • run ruby lib/server.rb

Now the server will be up on localhost:4000.

  • CREATE => POST /books (body fields => title, author *currently only support x-www-form-urlencoded)
  • UPDATE => POST /books/:id (body fields => title, author *currently only support x-www-form-urlencoded)
  • READ COLLECTION => GET /books
  • READ SINGULAR => GET /books/:id
  • DELETE => POST /books/:id/delete

Running the tests

  • Run rake command

#TODO

  • Add tests for the server code itself
  • Add a rake test for running server??
  • Add commandline options for specifying port
  • Support correct HTTP VERBS (DELETE and PATCH)
  • Support form-data, json payload for CREATE and UPDATE

About

A simple rest api server with ruby using only stdlib

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages