码迷,mamicode.com
首页 > Web开发 > 详细

07-json-server 工具使用

时间:2019-05-28 22:21:30      阅读:150      评论:0      收藏:0      [点我收藏+]

标签:安装   charset   view   name   cmd   def   scale   窗口   tle   

<!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 工具使用

标签:安装   charset   view   name   cmd   def   scale   窗口   tle   

原文地址:https://www.cnblogs.com/divtab/p/10940640.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!