Skip to content

Commit 7467448

Browse files
committed
Merge pull request typicode#236 from barrystaes/barrystaes-docs
Add README.md notes on doing requests
2 parents 321cbf2 + b15a9d3 commit 7467448

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+
- Your request body JSON should be 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. Only a value set in a POST request wil be respected, but only if not already taken.
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 without changes being made to the data.
4145

4246
## Install
4347

0 commit comments

Comments
 (0)