https://github.com/typicode/json-server
npm i json-server
- /db.json
{
"posts": [
{ "id": 1, "title": "json-server", "author": "typicode" }
],
"comments": [
{ "id": 1, "body": "some comment", "postId": 1 }
],
"profile": { "name": "typicode" }
}
- /package.json
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
+ "json-server": "json-server --watch db.json --port 3001"
},
npm run json-server
- 6th/August/2021