Skip to content

Commit 2c29354

Browse files
committed
Add README.md notes on doing requests
1 parent 321cbf2 commit 2c29354

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ Now if you go to [http://localhost:3000/posts/1](), you'll get
3737
{ "id": 1, "title": "json-server", "author": "typicode" }
3838
```
3939

40-
Also, if you make POST, PUT, PATCH or DELETE requests, changes will be automatically and safely saved to `db.json` using [lowdb](https://github.com/typicode/lowdb).
40+
Also when doing requests, its good to know that
41+
- If you make POST, PUT, PATCH or DELETE requests, changes will be automatically and safely saved to `db.json` using [lowdb](https://github.com/typicode/lowdb).
42+
- The request body JSON is object enclosed, just like the GET output. (for example `{"name": "Foobar"}`)
43+
- Id values are not mutable. Any `id` value in the body of your PUT or PATCH request wil be ignored, but a POST requests wil respect its value.
44+
- A POST, PUT or PATCH request should include a `Content-Type: application/json` header to use the JSON in the request body. Otherwise it wil result in a 200 OK but changes being made to the data.
4145

4246
## Install
4347

0 commit comments

Comments
 (0)