mirror of
https://github.com/typicode/json-server.git
synced 2025-07-28 20:52:08 +08:00
Update README.md
This commit is contained in:
18
README.md
18
README.md
@ -14,18 +14,10 @@ Create a `db.json` file
|
|||||||
```javascript
|
```javascript
|
||||||
{
|
{
|
||||||
"posts": [
|
"posts": [
|
||||||
{
|
{ "id": 1, "title": "json-server" }
|
||||||
"id": 1,
|
|
||||||
"title": "json-server",
|
|
||||||
"author": "typicode"
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
"comments": [
|
"comments": [
|
||||||
{
|
{ "id": 1, "body": "some comment", "postId": 1 }
|
||||||
"id": 1,
|
|
||||||
"body": "some comment",
|
|
||||||
"postId": 1
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -39,11 +31,7 @@ $ json-server db.json
|
|||||||
Now if you go to [http://localhost:3000/posts/1](), you'll get
|
Now if you go to [http://localhost:3000/posts/1](), you'll get
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
{
|
{ "id": 1, "title": "json-server" }
|
||||||
"id": 1,
|
|
||||||
"title": "json-server",
|
|
||||||
"author": "typicode"
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
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)
|
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)
|
||||||
|
Reference in New Issue
Block a user