{"_id":"@airquality/mock-server","_rev":"8-905920c57e9a768b910b6e9f70b21dc4","name":"@airquality/mock-server","dist-tags":{"latest":"0.1.4"},"versions":{"0.1.0":{"name":"@airquality/mock-server","version":"0.1.0","description":"Node mock server based on Koa","main":"src/index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/LeeWeisheng/mock-server.git"},"keywords":["mock","server","koa","node"],"author":{"name":"李蔚生","email":"971353677@qq.com"},"license":"MIT","bugs":{"url":"https://github.com/LeeWeisheng/mock-server/issues"},"homepage":"https://github.com/LeeWeisheng/mock-server#readme","devDependencies":{"eslint":"^4.19.1","eslint-config-standard":"^11.0.0","eslint-plugin-import":"^2.10.0","eslint-plugin-node":"^6.0.1","eslint-plugin-promise":"^3.7.0","eslint-plugin-standard":"^3.0.1"},"dependencies":{"@koa/cors":"^2.2.1","glob":"^7.1.2","koa":"^2.5.0","koa-body":"^2.5.0","koa-router":"^7.4.0","watch":"^1.0.2"},"bin":{"mock-server":"./bin/index.js"},"gitHead":"152763f392b56968fab6a2030f7b69f2ed5c0c33","_id":"@airquality/mock-server@0.1.0","_npmVersion":"5.8.0","_nodeVersion":"9.8.0","_npmUser":{"name":"airquality","email":"971353677@qq.com"},"dist":{"integrity":"sha512-xuHhMe9HOxGaBjtW7U6F+6628fdPQgqO+rv1ERFJ8cyn/E46zuxE3R6qHfCbxHnx4QHKON5HIWwWr1+IMsVE9Q==","shasum":"caec3be01ccbf65690e5f536a4d5a93563615deb","tarball":"https://registry.npmjs.org/@airquality/mock-server/-/mock-server-0.1.0.tgz","fileCount":7,"unpackedSize":5984,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC284HMkafMjj9aDfx3DZL4mDiw1OygRFMaE3aVJ/OpXQIgOZIWaA9kXqkbDMOBwSHmZlzGpYvjPuP1yZX9CSX5a8c="}]},"maintainers":[{"name":"airquality","email":"971353677@qq.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mock-server_0.1.0_1522829346731_0.5476091733679112"},"_hasShrinkwrap":false},"0.1.1":{"name":"@airquality/mock-server","version":"0.1.1","description":"Node mock server based on Koa","main":"src/index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/LeeWeisheng/mock-server.git"},"keywords":["mock","server","koa","node"],"author":{"name":"李蔚生","email":"971353677@qq.com"},"license":"MIT","bugs":{"url":"https://github.com/LeeWeisheng/mock-server/issues"},"homepage":"https://github.com/LeeWeisheng/mock-server#readme","devDependencies":{"eslint":"^4.19.1","eslint-config-standard":"^11.0.0","eslint-plugin-import":"^2.10.0","eslint-plugin-node":"^6.0.1","eslint-plugin-promise":"^3.7.0","eslint-plugin-standard":"^3.0.1"},"dependencies":{"@koa/cors":"^2.2.1","glob":"^7.1.2","koa":"^2.5.0","koa-body":"^2.5.0","koa-router":"^7.4.0","watch":"^1.0.2"},"bin":{"mock-server":"./bin/index.js"},"gitHead":"ca27a5c32b392e0c92057b06b4bdd0fd02d7390b","_id":"@airquality/mock-server@0.1.1","_npmVersion":"5.8.0","_nodeVersion":"9.8.0","_npmUser":{"name":"airquality","email":"971353677@qq.com"},"dist":{"integrity":"sha512-8ueBPwZYgyrmvbHDz8S2xKRi8zZYaZFmBvoMMso2zlH8SwO52SG6v8tamIJYJUE3OnRnBen6i3GYM+c0zWk7Tw==","shasum":"ffbd4f57c34136ddd2d5db0c6689735c854d56f6","tarball":"https://registry.npmjs.org/@airquality/mock-server/-/mock-server-0.1.1.tgz","fileCount":7,"unpackedSize":6684,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFOusT4eLkYyFbR807rwAkxXnSctzvfSlxgBtGvxIxs0AiEA+3ekOGSP5w9At1HRBOoyY39GF9x29u2hMKZkIZurggU="}]},"maintainers":[{"name":"airquality","email":"971353677@qq.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mock-server_0.1.1_1523076899246_0.676464879355454"},"_hasShrinkwrap":false},"0.1.2":{"name":"@airquality/mock-server","version":"0.1.2","description":"Node mock server based on Koa","main":"src/index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/LeeWeisheng/mock-server.git"},"keywords":["mock","server","koa","node"],"author":{"name":"李蔚生","email":"971353677@qq.com"},"license":"MIT","bugs":{"url":"https://github.com/LeeWeisheng/mock-server/issues"},"homepage":"https://github.com/LeeWeisheng/mock-server#readme","devDependencies":{"eslint":"^4.19.1","eslint-config-standard":"^11.0.0","eslint-plugin-import":"^2.10.0","eslint-plugin-node":"^6.0.1","eslint-plugin-promise":"^3.7.0","eslint-plugin-standard":"^3.0.1"},"dependencies":{"@koa/cors":"^2.2.1","glob":"^7.1.2","koa":"^2.5.0","koa-body":"^2.5.0","koa-router":"^7.4.0","require-from-string":"^2.0.1","watch":"^1.0.2"},"bin":{"mock-server":"./bin/index.js"},"gitHead":"6a298ec9c28f6969fbc46ae34745b4f89eaf629e","_id":"@airquality/mock-server@0.1.2","_npmVersion":"5.8.0","_nodeVersion":"9.8.0","_npmUser":{"name":"airquality","email":"971353677@qq.com"},"dist":{"integrity":"sha512-LIsTbvStDNGoNfddP6eyTG8AgBzXfRClNVv6c6MOTaiHtoVB/RO2Xg5zyqRQ262ujPFDtiCJy6Ztxk/HnLEbEg==","shasum":"fa61cb763e504861de45145403188366fa1585af","tarball":"https://registry.npmjs.org/@airquality/mock-server/-/mock-server-0.1.2.tgz","fileCount":7,"unpackedSize":6667,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDiE9TiremUnum3qQ1lnDZFM0faJeTAwW6LexuxuyPq5wIgCSV24hdc0AvHW0r8NFY9W0bFCCVAZX3nubd3cXXeGw8="}]},"maintainers":[{"name":"airquality","email":"971353677@qq.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mock-server_0.1.2_1523078506056_0.7878466731709965"},"_hasShrinkwrap":false},"0.1.3":{"name":"@airquality/mock-server","version":"0.1.3","description":"Node mock server based on Koa","main":"src/index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/LeeWeisheng/mock-server.git"},"keywords":["mock","server","koa","node"],"author":{"name":"李蔚生","email":"971353677@qq.com"},"license":"MIT","bugs":{"url":"https://github.com/LeeWeisheng/mock-server/issues"},"homepage":"https://github.com/LeeWeisheng/mock-server#readme","devDependencies":{"eslint":"^4.19.1","eslint-config-standard":"^11.0.0","eslint-plugin-import":"^2.10.0","eslint-plugin-node":"^6.0.1","eslint-plugin-promise":"^3.7.0","eslint-plugin-standard":"^3.0.1"},"dependencies":{"@koa/cors":"^2.2.1","delay":"^2.0.0","glob":"^7.1.2","koa":"^2.5.0","koa-body":"^2.5.0","koa-router":"^7.4.0","require-from-string":"^2.0.1","watch":"^1.0.2"},"bin":{"mock-server":"./bin/index.js"},"gitHead":"6d61b3cb0ebfd7ed0501678f4925817279c1af22","_id":"@airquality/mock-server@0.1.3","_npmVersion":"5.8.0","_nodeVersion":"9.8.0","_npmUser":{"name":"airquality","email":"971353677@qq.com"},"dist":{"integrity":"sha512-DfiorjMGKk3yoH3gFCTO2kQc+enojwgCpq2u9ESJA+kiEJVWt5kfH8p0jWV9Q3gdo7owAjEh/36xWwW74YZEcg==","shasum":"ad57aff906ec4d32252ecd5f1770873780ae4eeb","tarball":"https://registry.npmjs.org/@airquality/mock-server/-/mock-server-0.1.3.tgz","fileCount":7,"unpackedSize":7271,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFO0wsBqZ75llywBXVNU/bzrn24YgeGybT5DnfJ+WQJIAiBrfrYDrBUqfK404uWiVdZMc67N53BiZPM2oolMn9QmVQ=="}]},"maintainers":[{"name":"airquality","email":"971353677@qq.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mock-server_0.1.3_1523113277183_0.06388374524736262"},"_hasShrinkwrap":false},"0.1.4":{"name":"@airquality/mock-server","version":"0.1.4","description":"Node mock server based on Koa","main":"src/index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/LeeWeisheng/mock-server.git"},"keywords":["mock","server","koa","node"],"author":{"name":"李蔚生","email":"971353677@qq.com"},"license":"MIT","bugs":{"url":"https://github.com/LeeWeisheng/mock-server/issues"},"homepage":"https://github.com/LeeWeisheng/mock-server#readme","devDependencies":{"eslint":"^4.19.1","eslint-config-standard":"^11.0.0","eslint-plugin-import":"^2.10.0","eslint-plugin-node":"^6.0.1","eslint-plugin-promise":"^3.7.0","eslint-plugin-standard":"^3.0.1"},"dependencies":{"@koa/cors":"^2.2.1","delay":"^2.0.0","glob":"^7.1.2","koa":"^2.5.0","koa-body":"^2.5.0","koa-router":"^7.4.0","require-from-string":"^2.0.1","watch":"^1.0.2"},"bin":{"mock-server":"./bin/index.js"},"gitHead":"6a2992e17b6d9644e4338d86e6d39f3af0f2cce8","_id":"@airquality/mock-server@0.1.4","_npmVersion":"5.8.0","_nodeVersion":"9.8.0","_npmUser":{"name":"airquality","email":"971353677@qq.com"},"dist":{"integrity":"sha512-lzBFsO/wv3CVa4N9lHrKj1Xum4VJvlJDm7t1wQQo2kmkYJNnZ7ko2yzar0e5F7YELCOSvW5YxGlySM/+Sm0JHA==","shasum":"dc0e7be62e26df3aef1653d3f94fd0b9330ca6fd","tarball":"https://registry.npmjs.org/@airquality/mock-server/-/mock-server-0.1.4.tgz","fileCount":7,"unpackedSize":7307,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDwAaMRWLXNjQuBci9hhqlQT7eDI1IGqxEz8Z8fIDtQIAIhAIRNuu5rc2+POZ9daemIDiK28RawM/jXtEavqK0LAuIZ"}]},"maintainers":[{"name":"airquality","email":"971353677@qq.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mock-server_0.1.4_1523113516892_0.9865366607740182"},"_hasShrinkwrap":false}},"time":{"created":"2018-04-04T08:09:06.668Z","0.1.0":"2018-04-04T08:09:06.941Z","modified":"2022-04-04T12:23:09.699Z","0.1.1":"2018-04-07T04:54:59.364Z","0.1.2":"2018-04-07T05:21:46.143Z","0.1.3":"2018-04-07T15:01:17.322Z","0.1.4":"2018-04-07T15:05:17.028Z"},"maintainers":[{"email":"npm@npmjs.com","name":"npm"}],"description":"Node mock server based on Koa","homepage":"https://github.com/LeeWeisheng/mock-server#readme","keywords":["mock","server","koa","node"],"repository":{"type":"git","url":"git+https://github.com/LeeWeisheng/mock-server.git"},"author":{"name":"李蔚生","email":"971353677@qq.com"},"bugs":{"url":"https://github.com/LeeWeisheng/mock-server/issues"},"license":"MIT","readme":"# mock-server\n\nNode mock server based on Koa.\n\n- Writing routes configuration.\n- Custom request handlers.\n- Watching file changes, and restarting server.\n\n## Install\n\n```shell\nnpm install @airquality/mock-server\n```\n\n## Usage\n\nAll `.js` files in cwd(current work directory) will be watched and treated as routes configuration files. Every `.js` file must be exported an array property `routes`. Every route object in `routes` must exist three properties: `path`, `method` and `handler`. The `handler` function will be injected a request data object. See following:\n\n```js\n// HelloWorld.js\nmodule.exports = {\n  routes: [\n    {\n      path: '/',\n      method: 'get',\n      handler: ({ headers, params, query, body, cookies, ctx }) => {\n        // You can get request data by above params.\n\n        // Returns will be sent to client.\n        return 'Hello World!'\n      },\n    },\n  ],\n}\n```\n\nIn your `package.json` file, add a script to start mock server by use `mock-server` command.\n\n```js\n// package.json\n...\nscript: {\n  \"mock\": \"mock-server\",\n  ...\n}\n...\n```\n\nFinally, type `npm run mock` in your work directory.\n\n```shell\nnpm run mock\n```\n\n## Options\n\nSet `mockServerOptions` in `package.json` file to change default options.\n\n```js\n// package.json\n...\n\"mockServerOptions\": {\n  // Default path is cwd(current work directory)\n  \"path\": \"./routes\",\n  // Default server port is 4000\n  \"port\": 4001\n}\n...\n```\n\n## Simulated Data\n\nYou can use [faker.js](https://github.com/marak/Faker.js/) to generate data.\n\n## License\n\nMIT.\n","readmeFilename":"README.md"}