0.0.3 • Published 8 years ago

trashdispenser v0.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

trashdispenser

Quickly create a server to mock responses :poop:

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