Skip to content

zhangmengxue/koa-rest

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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.

About

REST demo with koa.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 80.9%
  • HTML 15.6%
  • CSS 3.5%