Skip to content
Mock REST api middleware for express
Branch: master
Clone or download
Pull request Compare This branch is 1 commit behind Dome9:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example
test
.gitignore
LICENSE
README.md
index.js
package.json

README.md

rest-mock

A REST api middleware for express to mock API requests with full CRUD operations.

npm i rest-mock --save

Usage:

var Mock = require('rest-mock');
var express = require('express');
var bodyParser = require('body-parser');

var app = express();
var mock = new Mock();

mock.resource('/config', { development: true });
mock.collection('/ips', [{ip: '192.1.1.1'}, {ip: '192.1.1.2'}, {ip: '192.1.1.3'}]);

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));

app.use('/api', mock.middleware());

app.listen(3000);

You have an example and tests.

You can’t perform that action at this time.