1.0.9 • Published 10 years ago

kgtool v1.0.9

Weekly downloads
1
License
ISC
Repository
github
Last release
10 years ago

kgtool

介绍:提供随机数据模拟功能,和简单的服务器,如有其它常用需求,可提出一些建议,后续进行开发。

  1. ##下载node

    node安装教程(http://www.runoob.com/nodejs/nodejs-install-setup.html)

  2. ##安装kgtool

    npm install kgtool -g

  3. ##启动本地服务   如需启动本地服务器,进入当前目录 cd desktop

    运行 kgtool server 如果执行无效,请安装 npm install anywhere -g

  4. ##基于MOCK的数据模拟功能

    使用kgtool init生成data.js文件  编写数据模板文件,

      module.exports = [
        {
          url: "/test",
          data: {
              "data": {
                 'list|20-50':[     //随机返回20-50条数据
                   {
                     "id|00000000-99999999" : 123456789,    //随机返回9位长度的数字
                     "award": '@ctitle(5, 15)'      //随机返回5-10个中文字符串
                   }
                ]
              }
          },
          time: 5000
        },
       ...
    ]

     `  其中url为请求路径, data为需要的返回的数据结构, time为返回时间(单位ms)

    启动服务

    kgtool -f data.js

     mock文档 http://mockjs.com/examples.html

     启动服务后访问http://127.0.0.1:8888/test, 即可返回数据

###支持参数:

 - port 可选(启动的端口,默认为8888)

kgtool -port 8090

 - f  必填(data.js配置文件路径)

kgtool -f ../data.js

1.0.9

10 years ago

1.0.8

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago