trashdispenser

0.0.3 • Public • Published

trashdispenser

Quickly create a server to mock responses 💩

npm install -g trashdispenser

Built using Restify.

Usage

Command Line

trashdispenser config.json

Where 'config.json' is a file containing configuration.

Code

var trashdispenser = require( 'trashdispenser' );

trashdispenser.dispense( config, function( server ) // callback optional
{
  // server is a restify server object
});

Config

{
	"url" : "yourservers.url.com",
	"port" : 8080,
	"endPoints" :
	[
		{
			"uri" : "/an/endpoint/:environment",
			"method" : "get",
			"data" :
			[
				"random data",
				"more random data"
			]
		},
        {
			"uri" : "/another/:endpoint",
			"method" : "get",
			"data" :
			[
				"random data",
				"more random data"
			]
		}
	] 
}

Data returned from requests is chosen randomly from the data array.

If url attribute is not set, will default to local host.

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i trashdispenser

Weekly Downloads

0

Version

0.0.3

License

MIT

Last publish

Collaborators

  • jamesfrosty