You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-10Lines changed: 9 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -20,8 +20,7 @@ See also:
20
20
<!-- toc -->
21
21
22
22
-[Sponsorship](#sponsorship)
23
-
-[Example](#example)
24
-
-[Install](#install)
23
+
-[Getting started](#getting-started)
25
24
-[Routes](#routes)
26
25
*[Plural routes](#plural-routes)
27
26
*[Singular routes](#singular-routes)
@@ -63,7 +62,13 @@ See also:
63
62
64
63
</details>
65
64
66
-
## Example
65
+
## Getting started
66
+
67
+
Install JSON Server
68
+
69
+
```
70
+
npm install -g json-server
71
+
```
67
72
68
73
Create a `db.json` file
69
74
@@ -82,7 +87,7 @@ Create a `db.json` file
82
87
Start JSON Server
83
88
84
89
```bash
85
-
$ json-server --watch db.json
90
+
json-server --watch db.json
86
91
```
87
92
88
93
Now if you go to [http://localhost:3000/posts/1](http://localhost:3000/posts/1), you'll get
@@ -98,12 +103,6 @@ Also when doing requests, it's good to know that:
98
103
- Id values are not mutable. Any `id` value in the body of your PUT or PATCH request will be ignored. Only a value set in a POST request will be respected, but only if not already taken.
99
104
- A POST, PUT or PATCH request should include a `Content-Type: application/json` header to use the JSON in the request body. Otherwise it will result in a 200 OK but without changes being made to the data.
100
105
101
-
## Install
102
-
103
-
```bash
104
-
$ npm install -g json-server
105
-
```
106
-
107
106
## Routes
108
107
109
108
Based on the previous `db.json` file, here are all the default routes. You can also add [other routes](#add-custom-routes) using `--routes`.
0 commit comments