07-json-server 工具使用
Posted divtab
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了07-json-server 工具使用相关的知识,希望对你有一定的参考价值。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<div>
安装 npm i -g json-server
使用软件 ConEmu , 在db.json 文件夹里
在命令窗口输入 json-server --watch db.json 开启服务器
</div>
</body>
</html>
1.把下面的数据放在 db.json文件里面
2.在db.json 同目录下 打开cmd,在命令窗口输入 json-server --watch db.json 开启服务器
以下是db.json
{
"brands": [
{
"name": "abcd",
"date": "2018-07-04T09:02:14.446Z",
"id": 8
},
{
"name": "abcde",
"date": "2018-07-04T09:02:15.611Z",
"id": 9
},
{
"name": "abcdef",
"date": "2018-07-04T09:02:16.819Z",
"id": 10
},
{
"name": "abcdefg",
"date": "2018-07-04T09:02:18.261Z",
"id": 11
},
{
"name": "abcdefgh",
"date": "2018-07-04T09:02:20.090Z",
"id": 12
},
{
"name": "123",
"date": "2018-07-05T01:03:38.971Z",
"id": 13
},
{
"name": "123",
"date": "2018-07-05T01:03:39.621Z",
"id": 14
},
{
"name": "123",
"date": "2018-07-05T01:03:40.267Z",
"id": 15
},
{
"name": "aa",
"date": "2018-08-09T07:36:24.419Z",
"id": 16
},
{
"name": "aa",
"date": "2018-08-09T07:36:27.461Z",
"id": 17
},
{
"name": "hahhahahahaha11111",
"date": "2019-2-13",
"id": 21
},
{
"name": "123123123123",
"date": "2019-2-14",
"id": 22
},
{
"name": "321",
"date": "2019-2-15",
"id": 23
},
{
"name": "321",
"date": "2019-2-15",
"id": 27
},
{
"name": "321",
"date": "2019-2-15",
"id": 28
},
{
"name": "321",
"date": "2019-2-15",
"id": 29
},
{
"name": "456",
"date": "2019-2-15",
"id": 32
},
{
"name": "abccccc",
"date": "2019-02-13T03:02:55.342Z",
"id": 33
},
{
"name": "修改后的",
"date": "2019-02-13T03:04:56.107Z",
"id": 34
},
{
"name": "1",
"date": "2019-02-13T06:26:08.142Z",
"id": 35
},
{
"name": "2131241",
"date": "2019-02-13T06:26:14.145Z",
"id": 36
},
{
"name": "1",
"date": "2019-05-27T16:35:33.747Z",
"id": 37
},
{
"name": "123",
"date": "2019-05-27T16:35:35.722Z",
"id": 38
},
{
"name": "1",
"date": "2019-05-27T16:37:55.145Z",
"id": 39
}
]
}
以上是关于07-json-server 工具使用的主要内容,如果未能解决你的问题,请参考以下文章