Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jamesfrost/trashdispenser

Quickly create a server to mock responses
https://github.com/jamesfrost/trashdispenser

Last synced: about 1 month ago
JSON representation

Quickly create a server to mock responses

Awesome Lists containing this project

README

        

# trashdispenser
Quickly create a server to mock responses :poop:

```bash
npm install -g trashdispenser
```
Built using Restify.
## Usage
### Command Line
```bash
trashdispenser config.json
```
Where 'config.json' is a file containing configuration.
### Code
```js
var trashdispenser = require( 'trashdispenser' );

trashdispenser.dispense( config, function( server ) // callback optional
{
// server is a restify server object
});
```
## Config
```json
{
"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