Skip to content

Commit d98d0bc

Browse files
authored
Update README.md
1 parent b94c380 commit d98d0bc

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

README.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,15 @@
22

33
[![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-
## Usage
6-
7-
Install `json-server`
5+
## Install
86

97
```shell
108
npm install json-server@alpha
119
```
1210

13-
Create a `db.json` file or run `json-server db.json` to create one with some default resources
11+
## Usage
1412

15-
> [!TIP]
16-
> You can also use [json5](https://json5.org/) format by creating a `db.json5` instead
13+
Create a `db.json` or `db.json5` file
1714

1815
```json
1916
{
@@ -28,8 +25,15 @@ Create a `db.json` file or run `json-server db.json` to create one with some def
2825
}
2926
```
3027

28+
Pass it to JSON Server CLI
29+
3130
```shell
3231
json-server db.json
32+
```
33+
34+
Get a REST API
35+
36+
```shell
3337
curl -H "Accept: application/json" -X GET http://localhost:3000/posts/1
3438
{
3539
"id": "1",
@@ -45,7 +49,8 @@ Run `json-server --help` for a list of options
4549
GET /posts
4650
GET /posts/:id
4751
POST /posts
48-
PUT /posts
52+
PUT /posts/:id
53+
PATCH /posts/:id
4954
DELETE /posts/:id
5055
```
5156

0 commit comments

Comments
 (0)