mirror of
https://github.com/typicode/json-server.git
synced 2025-07-28 12:43:18 +08:00
updated README
This commit is contained in:
11
README.md
11
README.md
@ -15,7 +15,7 @@ Created with :heart: for front-end developers who need a flexible back-end for q
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ cat db.json
|
$ cat db.json
|
||||||
{
|
{
|
||||||
posts: [
|
posts: [
|
||||||
{ id: 1, body: 'foo' }
|
{ id: 1, body: 'foo' }
|
||||||
]
|
]
|
||||||
@ -24,6 +24,9 @@ $ json-server --file db.json
|
|||||||
$ curl -i http://localhost:3000/posts/1
|
$ curl -i http://localhost:3000/posts/1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You can type 's' at any moment to save the current live JSON object to timestamped
|
||||||
|
file.
|
||||||
|
|
||||||
### Node module
|
### Node module
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
@ -52,7 +55,7 @@ You can find a running demo here: http://jsonplaceholder.typicode.com.
|
|||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ npm install -g json-server
|
$ npm install -g json-server
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -113,7 +116,7 @@ Here's 2 examples showing how to format JSON or JS seed file:
|
|||||||
```javascript
|
```javascript
|
||||||
exports.run = function() {
|
exports.run = function() {
|
||||||
var data = {};
|
var data = {};
|
||||||
|
|
||||||
data.posts = [];
|
data.posts = [];
|
||||||
data.posts.push({id: 1, body: 'foo'});
|
data.posts.push({id: 1, body: 'foo'});
|
||||||
//...
|
//...
|
||||||
@ -180,6 +183,6 @@ For project updates or to get in touch, [@typicode](http://twitter.com/typicde).
|
|||||||
## Test
|
## Test
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ npm install
|
$ npm install
|
||||||
$ npm test
|
$ npm test
|
||||||
```
|
```
|
||||||
|
Reference in New Issue
Block a user