node-stubby-server-cli
Module which exposes the Stubby Server API interface from node. The API is clean and simple to use. Note that if you mute() the client, you cannot get any events so it's NOT recommended to do this.
We also use ES6 weakmaps to make certain properties private, however, a polyfill is included in the event your application isn't ES6 ready. Please fork and enhance or file a bug ticket if you notice any issues
ES6
node --harmony <script>.js
< ES6
node <script>.js
Installation
Install this module via npm
npm -i node-stubby-server-cli
Example usage
var cli = ; cli // prints the help... note you still chain // supress output data__dirname + '/data.yml' // enable output start ; // server should be running after this... cli // note events won't be dispatch if muted
Example data file (routes)
"request": "url": "^/my-api/" "method": "GET" "body": "Hello World" "response": "status": 200 "headers": "Content-Type": "application/json" "file": "data.json"
Gulp.js Example
var gulp = ;var mocha = ;var StubbyCLI = ;var Events = stubbyCLIEvents; gulp; gulp; gulp; // Default tasks to rungulp;
Event.REQUEST Payload
Event.RESPONSE Payload
Test
npm test