优秀的编程知识分享平台

网站首页 > 技术文章 正文

json - server:mock接口工具使用(mock-server.js)

nanyue 2024-09-29 15:00:33 技术文章 12 ℃


1

安装node.js exe文件

2

安装json-server

npm install -g json-server

检测是否安装成功:

json-server -h

3

新建json文件 并运行

json-server --port 4443 data.json

或 json-server data.json(默认port3000)

4

json文件格式:

"users":[

{

"name":"wyye",

"phone":"23737373",

"mail":"yeye@wyye.com"

},

{

"name2":"wyey2",

"phone":"363673",

"mail":"ueueu@uwue.com"

}

],

"areas":[

{

"id":"1",

"area":"area1"

},

{

"id2":"2",

"area":"area2"

}

]


Tags:

最近发表
标签列表