Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alonronin/rest-mock
Mock REST api middleware for express
https://github.com/alonronin/rest-mock
Last synced: 24 days ago
JSON representation
Mock REST api middleware for express
- Host: GitHub
- URL: https://github.com/alonronin/rest-mock
- Owner: alonronin
- License: mit
- Created: 2016-11-14T11:32:25.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2015-06-23T14:12:32.000Z (over 9 years ago)
- Last Synced: 2024-05-21T05:12:33.152Z (6 months ago)
- Language: JavaScript
- Homepage:
- Size: 184 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rest-mock
> A REST api middleware for express to mock API requests with full CRUD operations.
`npm i rest-mock --save`
Usage:
```javascript
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.