mocker-data-webpack

0.0.1 • Public • Published

mocker-data-webpack

A webpack-dev-server middleware for mock api response.

Installation

You can install it via yarn or npm.

$ yarn add mocker-data-webpack --dev
$ npm install mocker-data-webpack --save-dev

Usage

webpack.config.js

const mockerDataWebpack = require('mocker-data-webpack');
 
module.exports = {
  //...
  devServer: {
    before: mockerDataWebpack() // It accept a parameter with options
  }
};

Options

options.prefix

default: '/api'

The prefix of apis, all request start with it will be send to mocker-data-webpack, and you don't need to write it in your data files.

options.path

default: './mock'

The path of data files directory, you can pass relative path or absolute path, mocker-data-webpack will search this directory to find response for the request.

License

MIT

Package Sidebar

Install

npm i mocker-data-webpack

Weekly Downloads

5

Version

0.0.1

License

MIT

Unpacked Size

5.01 kB

Total Files

7

Last publish

Collaborators

  • yangmingshan