Skip to content

Commit 467f2e1

Browse files
authored
Restore original README content above Query capabilities overview (#1697)
1 parent 3e74640 commit 467f2e1

1 file changed

Lines changed: 83 additions & 21 deletions

File tree

README.md

Lines changed: 83 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,115 @@
1-
# JSON Server v1 (Beta)
1+
# JSON-Server
22

3-
Fast mock REST API from a JSON file.
3+
[![Node.js CI](https://github.com/typicode/json-server/actions/workflows/node.js.yml/badge.svg)](https://github.com/typicode/json-server/actions/workflows/node.js.yml)
44

5-
> Beta note: v1 can still change. For stable v0.17 docs, see:
6-
> https://github.com/typicode/json-server/tree/v0.17.4
5+
> [!IMPORTANT]
6+
> Viewing beta v1 documentation – usable but expect breaking changes. For stable version, see [here](https://github.com/typicode/json-server/tree/v0.17.4)
77
8-
## Quickstart (30s)
8+
> [!NOTE]
9+
> Using React ⚛️ and tired of CSS-in-JS? See [MistCSS](https://github.com/typicode/mistcss) 👀
910
10-
Install:
11+
## Install
1112

12-
```sh
13+
```shell
1314
npm install json-server
1415
```
1516

16-
Create `db.json`:
17+
## Usage
18+
19+
Create a `db.json` or `db.json5` file
1720

1821
```json
1922
{
23+
"$schema": "./node_modules/json-server/schema.json",
2024
"posts": [
21-
{ "id": "1", "title": "Hello", "views": 100 },
22-
{ "id": "2", "title": "World", "views": 200 }
25+
{ "id": "1", "title": "a title", "views": 100 },
26+
{ "id": "2", "title": "another title", "views": 200 }
27+
],
28+
"comments": [
29+
{ "id": "1", "text": "a comment about post 1", "postId": "1" },
30+
{ "id": "2", "text": "another comment about post 1", "postId": "1" }
2331
],
24-
"comments": [{ "id": "1", "text": "Nice", "postId": "1" }],
25-
"profile": { "name": "typicode" }
32+
"profile": {
33+
"name": "typicode"
34+
}
2635
}
2736
```
2837

29-
Run:
38+
<details>
3039

31-
```sh
32-
npx json-server db.json
40+
<summary>View db.json5 example</summary>
41+
42+
```json5
43+
{
44+
posts: [
45+
{ id: "1", title: "a title", views: 100 },
46+
{ id: "2", title: "another title", views: 200 },
47+
],
48+
comments: [
49+
{ id: "1", text: "a comment about post 1", postId: "1" },
50+
{ id: "2", text: "another comment about post 1", postId: "1" },
51+
],
52+
profile: {
53+
name: "typicode",
54+
},
55+
}
3356
```
3457

35-
Try:
58+
You can read more about JSON5 format [here](https://github.com/json5/json5).
3659

37-
```sh
38-
curl http://localhost:3000/posts/1
60+
</details>
61+
62+
Pass it to JSON Server CLI
63+
64+
```shell
65+
$ npx json-server db.json
3966
```
4067

41-
Response:
68+
Get a REST API
4269

43-
```json
70+
```shell
71+
$ curl http://localhost:3000/posts/1
4472
{
4573
"id": "1",
46-
"title": "Hello",
74+
"title": "a title",
4775
"views": 100
4876
}
4977
```
5078

79+
Run `json-server --help` for a list of options
80+
81+
## Sponsors ✨
82+
83+
### Gold
84+
85+
| |
86+
| :--------------------------------------------------------------------------------------------------------------------------------------------------------: |
87+
| <a href="https://mockend.com/" target="_blank"><img src="https://jsonplaceholder.typicode.com/mockend.svg" height="100px"></a> |
88+
| <a href="https://zuplo.link/json-server-gh"><img src="https://github.com/user-attachments/assets/adfee31f-a8b6-4684-9a9b-af4f03ac5b75" height="100px"></a> |
89+
| <a href="https://www.mintlify.com/"><img src="https://github.com/user-attachments/assets/bcc8cc48-b2d9-4577-8939-1eb4196b7cc5" height="100px"></a> |
90+
| <a href="http://git-tower.com/?utm_source=husky&utm_medium=referral"><img height="100px" alt="tower-dock-icon-light" src="https://github.com/user-attachments/assets/b6b4ab20-beff-4e5c-9845-bb9d60057196" /></a>
91+
92+
### Silver
93+
94+
| |
95+
| :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
96+
| <a href="https://requestly.com?utm_source=githubsponsor&utm_medium=jsonserver&utm_campaign=jsonserver"><img src="https://github.com/user-attachments/assets/f7e7b3cf-97e2-46b8-81c8-cb3992662a1c" style="height:70px; width:auto;"></a> |
97+
98+
### Bronze
99+
100+
| | |
101+
| :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
102+
| <a href="https://www.storyblok.com/" target="_blank"><img src="https://github.com/typicode/json-server/assets/5502029/c6b10674-4ada-4616-91b8-59d30046b45a" height="35px"></a> | <a href="https://betterstack.com/" target="_blank"><img src="https://github.com/typicode/json-server/assets/5502029/44679f8f-9671-470d-b77e-26d90b90cbdc" height="35px"></a> |
103+
104+
[Become a sponsor and have your company logo here](https://github.com/users/typicode/sponsorship)
105+
106+
## Sponsorware
107+
108+
> [!NOTE]
109+
> This project uses the [Fair Source License](https://fair.io/). Only organizations with 3+ users are kindly asked to contribute a small amount through sponsorship [sponsor](https://github.com/sponsors/typicode) for usage. **This license helps keep the project sustainable and healthy, benefiting everyone.**
110+
>
111+
> For more information, FAQs, and the rationale behind this, visit [https://fair.io/](https://fair.io/).
112+
51113
## Query capabilities overview
52114

53115
```http

0 commit comments

Comments
 (0)