Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/jamesfrost/trashdispenser
- Owner: JamesFrost
- License: mit
- Created: 2016-10-03T11:44:16.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2016-10-04T12:00:00.000Z (about 8 years ago)
- Last Synced: 2024-11-13T03:24:19.141Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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