1.0.1 • Published 4 years ago

dw-mx-request-mock v1.0.1

Weekly downloads
15
License
-
Repository
-
Last release
4 years ago

dw-mx-request-mock

dw-mx-request-mock 需要配合 dw-mx-request 使用,为其mock后端数据,使 dw-mx-request 能够在开发状态下模拟后端请求数据。

安装

  • npm
npm install dw-mx-request-mock --dev

webpack支持

修改 webpack.config.js, 新增以下内容:

const { webpackDevServerMock } = require('dw-mx-request-mock');

module.exports = {
    devServer: {
        before: webpackDevServerMock
    }
};

使用

  • 在项目目录下新建mock文件 mock/xxx.js, 文件内容导出为请求URL及其数据。
module.exports = {
    //  请求路径 : 请求数据
    '/mx/login/doLogin': "uuid-mx-202006030944",
    '/mx/getPerson': {
        name: '张三',
        sex: '男'
    }
}
1.0.1

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago