Update README.md

This commit is contained in:
typicode
2015-05-08 17:21:36 +02:00
parent 93a6000b2b
commit 50faba6a56

View File

@ -1,15 +1,12 @@
# JSON Server [![](https://travis-ci.org/typicode/json-server.svg)](https://travis-ci.org/typicode/json-server) [![](https://badge.fury.io/js/json-server.svg)](http://badge.fury.io/js/json-server) # JSON Server [![](https://travis-ci.org/typicode/json-server.svg)](https://travis-ci.org/typicode/json-server) [![](https://badge.fury.io/js/json-server.svg)](http://badge.fury.io/js/json-server) [![Join the chat at https://gitter.im/typicode/json-server](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/typicode/json-server?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
> Get a full fake REST API with __zero coding__ in __less than 30 seconds__ (seriously) > Get a full fake REST API with __zero coding__ in __less than 30 seconds__ (seriously)
Created with <3 for front-end developers who need a quick back-end for prototyping and mocking. Created with <3 for front-end developers who need a quick back-end for prototyping and mocking.
Links:
* [JSONPlaceholder - Live running version](http://jsonplaceholder.typicode.com) * [JSONPlaceholder - Live running version](http://jsonplaceholder.typicode.com)
* [Online video tutorial - Creating demo APIs with json-server](https://egghead.io/lessons/nodejs-creating-demo-apis-with-json-server) * [Online video tutorial - Creating demo APIs with json-server](https://egghead.io/lessons/nodejs-creating-demo-apis-with-json-server)
## Example ## Example
Create a `db.json` file Create a `db.json` file
@ -37,7 +34,7 @@ Now if you go to [http://localhost:3000/posts/1](), you'll get
{ "id": 1, "title": "json-server", "author": "typicode" } { "id": 1, "title": "json-server", "author": "typicode" }
``` ```
Also, if you make POST, PUT, PATCH or DELETE requests, changes will be saved to `db.json` Also, if you make POST, PUT, PATCH or DELETE requests, changes will be automatically saved to `db.json` using [lowdb](https://github.com/typicode/lowdb)
## Routes ## Routes
@ -121,7 +118,7 @@ module.exports = function() {
data = { users: [] } data = { users: [] }
// Create 1000 users // Create 1000 users
for (var i = 0; i < 1000; i++) { for (var i = 0; i < 1000; i++) {
data.users.push({ name: 'user' + i }) data.users.push({ id: i, name: 'user' + i })
} }
return data return data
} }
@ -159,7 +156,7 @@ You can deploy JSON Server. For example, [JSONPlaceholder](http://jsonplaceholde
### Articles ### Articles
* [Fast prototyping using Restangular and Json-server](http://glebbahmutov.com/blog/fast-prototyping-restangular-and-json-server/) * [Fast prototyping using Restangular and Json-server](http://glebbahmutov.com/blog/fast-prototyping-using-restangular-and-json-server/)
* [ng-admin: Add an AngularJS admin GUI to any RESTful API](http://marmelab.com/blog/2014/09/15/easy-backend-for-your-restful-api.html) * [ng-admin: Add an AngularJS admin GUI to any RESTful API](http://marmelab.com/blog/2014/09/15/easy-backend-for-your-restful-api.html)
* [how to build quick json REST APIs for development](http://outloudthinking.me/how-to-build-quick-json-rest-apis/) * [how to build quick json REST APIs for development](http://outloudthinking.me/how-to-build-quick-json-rest-apis/)