0.1.4 • Published 7 years ago

mockit-sw v0.1.4

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

mockit

Mock server in your browser.

Install

npm install mockit-sw --save-dev

Config

Create a file named mockit.config.js. An example is provided below:

// mockit.config.js
module.exports = {
  'GET /api/pubs/:pubid': {
    type: 'object',
    properties: {
      id: { type: 'string', format: 'uuid' },
      name: { type: 'string', format: 'name' },
      description: { type: 'string', format: 'lorem' }
    }
  },
  'POST /api/pubs': {
    type: 'object',
    properties: {
      status: { type: 'boolean' },
      created_id: { type: 'string', format: 'uuid' }
    }
  }
};

Run

  1. Add a script to your package.json file.

    // part of package.json
    {
      "scripts": {
        "mock": "mockit"
      }
    }
  2. Just run npm run mock.