json server https://github.com/typicode/json-server 全局安装 npm i -g json-server 安装后 输入 json-server 没报错说明安装成功 在任意目录创建db.json 监听: json-server --watch --port 3001 db.json
前缀作为端口后的访问地址
{ "posts": [ { "id": 1, "title": "json-server", "author": "typicode" } ], "comments": [ { "id": 1, "body": "some comment", "postId": 1 } ], "profile": { "name": "typicode" } }