|
1 |
| -# JSON Server [](https://travis-ci.org/typicode/json-server) [](http://badge.fury.io/js/json-server) |
| 1 | +# JSON Server [](https://travis-ci.org/typicode/json-server) [](http://badge.fury.io/js/json-server) [](https://gitter.im/typicode/json-server?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) |
2 | 2 |
|
3 | 3 | > Get a full fake REST API with __zero coding__ in __less than 30 seconds__ (seriously)
|
4 | 4 |
|
5 | 5 | Created with <3 for front-end developers who need a quick back-end for prototyping and mocking.
|
6 | 6 |
|
7 |
| -Links: |
8 | 7 | * [JSONPlaceholder - Live running version](http://jsonplaceholder.typicode.com)
|
9 | 8 | * [Online video tutorial - Creating demo APIs with json-server](https://egghead.io/lessons/nodejs-creating-demo-apis-with-json-server)
|
10 | 9 |
|
11 |
| - |
12 |
| - |
13 | 10 | ## Example
|
14 | 11 |
|
15 | 12 | Create a `db.json` file
|
@@ -37,7 +34,7 @@ Now if you go to [http://localhost:3000/posts/1](), you'll get
|
37 | 34 | { "id": 1, "title": "json-server", "author": "typicode" }
|
38 | 35 | ```
|
39 | 36 |
|
40 |
| -Also, if you make POST, PUT, PATCH or DELETE requests, changes will be saved to `db.json` |
| 37 | +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) |
41 | 38 |
|
42 | 39 | ## Routes
|
43 | 40 |
|
@@ -121,7 +118,7 @@ module.exports = function() {
|
121 | 118 | data = { users: [] }
|
122 | 119 | // Create 1000 users
|
123 | 120 | for (var i = 0; i < 1000; i++) {
|
124 |
| - data.users.push({ name: 'user' + i }) |
| 121 | + data.users.push({ id: i, name: 'user' + i }) |
125 | 122 | }
|
126 | 123 | return data
|
127 | 124 | }
|
@@ -159,7 +156,7 @@ You can deploy JSON Server. For example, [JSONPlaceholder](http://jsonplaceholde
|
159 | 156 |
|
160 | 157 | ### Articles
|
161 | 158 |
|
162 |
| -* [Fast prototyping using Restangular and Json-server](http://glebbahmutov.com/blog/fast-prototyping-restangular-and-json-server/) |
| 159 | +* [Fast prototyping using Restangular and Json-server](http://glebbahmutov.com/blog/fast-prototyping-using-restangular-and-json-server/) |
163 | 160 | * [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)
|
164 | 161 | * [how to build quick json REST APIs for development](http://outloudthinking.me/how-to-build-quick-json-rest-apis/)
|
165 | 162 |
|
|
0 commit comments