An open API service indexing awesome lists of open source software.

https://github.com/codeestx/my-restful-api

My RESTful API based on node.js & koa2
https://github.com/codeestx/my-restful-api

Last synced: 3 months ago
JSON representation

My RESTful API based on node.js & koa2

Awesome Lists containing this project

README

        

基于node.js + koa2搭建的restfulapi demo,扩展自[learn-javascript](https://github.com/michaelliao/learn-javascript),基本涵盖了主要的api类型,联动文章:[编写](http://codeest.cn/2016/09/21/web-api-code/) [部署](http://codeest.cn/2016/09/24/web-api/)

#Usage
项目目录下执行,`node start`

* GET (json)
`http://localhost:3000/api/geeknews/version`
`http://localhost:3000/api/products`

* GET (image)
`http://localhost:3000/img/test.jpg`

* GET (file)
`http://localhost:3000/apk/geeknews.apk`

* POST (json)
`http://localhost:3000/api/products`
body {"name":"XBox","price":3999}

* DELETE (json)
`http://localhost:3000/api/products/p1`