0.0.3 • Published 4 years ago

trashdispenser v0.0.3

Weekly downloads
1
License
MIT
Repository
github
Last release
4 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

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago