1.0.4 • Published 4 years ago

@acme-top/express-mock-middleware v1.0.4

Weekly downloads
6
License
MIT
Repository
github
Last release
4 years ago

express-mock-middleware

express-mock-middleware 是一个参考了 umijs 实现了其类似的基于 express 的 mock 中间件,可以方便 react 项目集成

Installation

npm install --save-dev @acme-top/express-mock-middleware

Usage

  1. 使用 create-react-app 创建一个 react app 并 eject

  2. 在 src 目录下创建文件 setupProxy.js

setupProxy.js 内容如下:

const path = require("path");
const proxy = require('http-proxy-middleware');
const paths = require('../config/paths');

require('@babel/register');

module.exports = function (app) {

    const mockPaths = [
        // mock 数据的所在目录
        path.join(paths.appPath, 'mock')
    ];

    app.use(require("@acme-top/express-mock-middleware").createMiddleware(mockPaths));
};

License

MIT Copyright (c) 2019

1.0.4

4 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.1.0

5 years ago