1.json-server 作用: 根据指定的JSON文件,提供假数据接口
2.使用步骤
1.全局安装 json-server :npm i -g json-server
2.准备一个json数据
3.执行 : json-server data.json
01.png

打开http://localhost:3000/list](http://localhost:3000/list页面 json数据为

data.json的代码为:
{
"list": [{
"id": 1,
"name": "张三",
"age": 10
},
{
"id": 2,
"name": "李四",
"age": 20
},
{
"id": 3,
"name": "王五",
"age": 30
}
]
}
网友评论