npm.io
0.1.0 • Published 12 years ago

connect-mock

Licence
Version
0.1.0
Deps
0
Vulns
0
Weekly
0

connect-mock

Build status

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.