connect-mock
v0.1.0
Published
Connect middleware for easy file based API mocking
Downloads
112
Readme
connect-mock
Connect middleware for easy file-based API mocking
Usage
First, add files containing your API mock responses to a mock
directory.
Then, require
it and call it as a function, passing options.
mock = require('connect-mock')
options = {
mockDirectory: 'mocks/',
verbose: false
}
middlewares.push[mock(options)]
Important: If you expect an answer from a endpoint which collides with a directory,
you can use a file with the same name as the directory. See examples in mock/
folder.