Json-server的使用步骤
1、在线文档 : https://github.com/typicode/json-server
2、下载: npm install -g json-server
3、目标根目录下创建数据库json文件:db.json
{
"posts": [
{ "id": 1, "title": "json-server", "author": "typicode" }
],
"comments": [
{ "id": 1, "body": "some comment", "postId": 1 }
],
"profile": { "name": "typicode" }
}
4、启动服务:json-server --watch db.json