1#Install JSON Server
2npm install -g json-server
3
4#Start JSON Server
5json-server --watch db.json
6
1npm i --save-dev json-server
2
3<add db.json file>
4npx json-server --watch db.json
5
6# to change port
7npx json-server --watch db.json --port 8000
1{
2 "posts": [
3 { "id": 1, "title": "json-server", "author": "typicode" }
4 ],
5 "comments": [
6 { "id": 1, "body": "some comment", "postId": 1 }
7 ],
8 "profile": { "name": "typicode" }
9}