quick-mock

0.0.6 • Public • Published

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)

Readme

Keywords

Package Sidebar

Install

npm i quick-mock

Weekly Downloads

0

Version

0.0.6

License

ISC

Last publish

Collaborators

  • hellojosh