mirror of
https://github.com/typicode/json-server.git
synced 2025-07-27 20:23:34 +08:00
Document singular resources
This commit is contained in:
14
README.md
14
README.md
@ -20,7 +20,8 @@ Create a `db.json` file
|
||||
],
|
||||
"comments": [
|
||||
{ "id": 1, "body": "some comment", "postId": 1 }
|
||||
]
|
||||
],
|
||||
"profile": { "name": "typicode" }
|
||||
}
|
||||
```
|
||||
|
||||
@ -48,6 +49,8 @@ $ npm install -g json-server
|
||||
|
||||
Based on the previous `db.json` file, here are all the default routes. You can also add [other routes](#add-routes) using `--routes`.
|
||||
|
||||
Plural resources
|
||||
|
||||
```
|
||||
GET /posts
|
||||
GET /posts/1
|
||||
@ -58,6 +61,15 @@ PATCH /posts/1
|
||||
DELETE /posts/1
|
||||
```
|
||||
|
||||
Singular resources
|
||||
|
||||
```
|
||||
GET /profile
|
||||
POST /profile
|
||||
PUT /profile
|
||||
PATCH /profile
|
||||
```
|
||||
|
||||
To filter resources (use `.` to access deep properties)
|
||||
|
||||
```
|
||||
|
Reference in New Issue
Block a user