Skip to content

cyberFund/ico-callbacks

 
 

Repository files navigation

#koa-REST

REST demo with koa.

This is a simple demo of RESTful API with koajs checkout the live demo

How to try it?

$ git clone https://github.com/hemanth/koa-rest.git

$ cd koa-rest

$ mongoimport -d library -c books ./db.json  # Import the DB, makes sure mongod is running.

$ npm install

$ npm run start

Open http://localhost:1337 to see the results.


GET /books -> List all the books in JSON.

GET /books/:id -> Returns the book for the given ID

POST /books/ -> JSON data to inserted to the books db.

PUT /books/:id -> JSON data to update the book data.

DELETE /books/:id -> Removes the book with the specified ID.

OPTIONS / -> Gives the list of allowed request types.

HEAD / -> HTTP headers only, no body.

TRACE / -> Blocked for security reasons.

Packages

No packages published

Languages

  • JavaScript 89.6%
  • HTML 8.8%
  • CSS 1.6%