mirror of
https://github.com/typicode/json-server.git
synced 2025-07-25 03:07:46 +08:00
docs: example
This commit is contained in:
14
README.md
14
README.md
@ -18,8 +18,8 @@ Create a `db.json` or `db.json5` file
|
|||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"posts": [
|
"posts": [
|
||||||
{ "id": "1", "title": "a title" },
|
{ "id": "1", "title": "a title", "views": 100 },
|
||||||
{ "id": "2", "title": "another title" }
|
{ "id": "2", "title": "another title", "views": 200 }
|
||||||
],
|
],
|
||||||
"comments": [
|
"comments": [
|
||||||
{ "id": "1", "text": "a comment about post 1", "postId": "1" },
|
{ "id": "1", "text": "a comment about post 1", "postId": "1" },
|
||||||
@ -38,8 +38,8 @@ Create a `db.json` or `db.json5` file
|
|||||||
```json5
|
```json5
|
||||||
{
|
{
|
||||||
posts: [
|
posts: [
|
||||||
{ id: '1', title: 'a title' },
|
{ id: '1', title: 'a title', views: 100 },
|
||||||
{ id: '2', title: 'another title' },
|
{ id: '2', title: 'another title', views: 200 },
|
||||||
],
|
],
|
||||||
comments: [
|
comments: [
|
||||||
{ id: '1', text: 'a comment about post 1', postId: '1' },
|
{ id: '1', text: 'a comment about post 1', postId: '1' },
|
||||||
@ -153,9 +153,9 @@ GET /posts?_sort=id,-views
|
|||||||
- `x.y.z[i]...`
|
- `x.y.z[i]...`
|
||||||
|
|
||||||
```
|
```
|
||||||
GET /posts?author.name=foo
|
GET /foo?a.b=bar
|
||||||
GET /posts?author.email=foo
|
GET /foo?x.y_lt=100
|
||||||
GET /posts?tags[0]=foo
|
GET /foo?arr[0]=bar
|
||||||
```
|
```
|
||||||
|
|
||||||
### Embed
|
### Embed
|
||||||
|
Reference in New Issue
Block a user