The Wayback Machine - https://web.archive.org/web/20200705172154/https://github.com/iview/iview-admin/issues/1317
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用 http-mock-middleware 替换 Mock, easy-mock #1317

Open
mystorp opened this issue Jul 31, 2019 · 0 comments
Open

使用 http-mock-middleware 替换 Mock, easy-mock #1317

mystorp opened this issue Jul 31, 2019 · 0 comments

Comments

@mystorp
Copy link

@mystorp mystorp commented Jul 31, 2019

使用 Mock mock 数据的时候,需要硬编码数据到代码里面

使用 easy-mock 需要外网访问

使用 http-mock-middleware 仅仅需要新增如下 devServer.after 的配置项,就可以很方便的管理假数据,也方便开发者任意的修改假数据,而不需要提交:

const httpMockMiddleware = require("hm-middleware");

module.exports = {
    devServer: {
        after: function(app, server){
            app.use(httpMockMiddleware({
                mockRules: {
                    "/": ".data"
                }
            }));
        }
    
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
1 participant
You can’t perform that action at this time.