fetchd

0.0.1 • Public • Published

RestAPI mock

Quick start

  • installation
npm install rmock --save-dev
  • useage
var rmock = require('rmock');
rmock.add(collctionRoutePath, modelRoutePath, initData)
rmock.add(routePath, initData)
rmock.add(routePath)
  • examples
var rmock = require('rmock');
rmock.add('/users', []);
//GET/POST: /users
//GET/PUT/DELETE: /users/:id

rmock.add('/users/:userId/books', '/users/books', [{
  id: 1,
  userId: 32,
  name: 'Javascript 权威指南'
}])
// GET/POST: /users/:userId/books
// GET/PUT/DELETE: /users/books/:id

rmock.add('/users/:userId/books', [{
  id: 1,
  userId: 32,
  name: 'Javascript 权威指南'
}])
// GET/POST: /users/:userId/books
// GET/PUT/DELETE: /users/:userId/books/:id

// start mock server
rmock.start([ip], [port])
  • Dont support cluster mode, beause data is stored in memory variable

Readme

Keywords

Package Sidebar

Install

npm i fetchd

Weekly Downloads

0

Version

0.0.1

License

MIT

Last publish

Collaborators

  • stonephp