quick-mock v0.0.6
Quick Mock
quick-mock is the easiest way to create mock APIs.
Installing
Installation via npm:
npm install quick-mock -gUsage
Starting quick mock
quick-mockAvailable options
-p Port to use (defaults to 8080)
-a Address to user (defaults to localhost)
-c Directory of URL JSON file (defaults to ../config.json)
-h Prints this list of options
URL JSON file
This file contains all of the paths that will be mocked. The file will contain an array of object. Each object is a route and can contain any type of values. Each string value is a key that refers to a faker.js function.
Here is an example:
[
{ "url": "/names", "method": "get", "return": "zipCode", "count": 5 },
{ "url": "/self", "method": "get", "return": { "zipCode": "zipCode", "name": [ "streetAddress", { "country": "country" }, "zipCode" ] }, "count": 5, "single": true }
]Route options
url - This is the mocked route (defaults to /)
method - The HTML verb for the route (defaults to get)
return - This is the object that gets returned (defaults to an empty string)
count - The number of objects returned (defaults to 1)
single - If set to true, the route will return an single object instead of an array (defaults to false)