0.0.6 • Published 7 years ago

quick-mock v0.0.6

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

Quick Mock

quick-mock is the easiest way to create mock APIs.

Installing

Installation via npm:

npm install quick-mock -g

Usage

Starting quick mock

quick-mock

Available 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)

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago