raml-1-mocker
Node module to create mock API service based on RAML 1.0 definition. Forked from https://github.com/repocho/raml-mocker and remaked.
Using RAML 1.0 mock-service
For single file ...
var ramlMocker = ;var options = path: 'test/raml';var { console;};ramlMocker;
... or for collection of files
var options = files: 'definition1.raml' 'folder/definition2.raml';
The result of execution:
/** URI of the request to mock {string|RegExp}*/ uri: '/test/:id/objectDef' // or RegExp: /\/test\/\d+/ /** Method of the request (get, post, ...) */ method: 'get' /** Function by default to return the mock (codes 2XX defined in the RAML). */ mock: Function /** If you don't define a 2XX code or want to use randomly other code responses. You can use this function * Just use instead of mock(); -> mockByCode(418); */ mockByCode: Functioncode /** Function by default to return the example (codes 2XX defined in the RAML). */ example: Function /** The same as mockByCode but applied to examples */ exampleByCode: Functioncode
Callback for [express] app
var { _;};
Used
History Log
0.0.1
- Basic functional