const {createProxyMiddleware} = require('http-proxy-middleware')
module.exports = function(app){
app.use(
'/api',
createProxyMiddleware( //1.0.0 版本的援用形式官网规定 createProxyMiddleware
{
target: 'http://127.0.0.1:5000', // 这里用 ip+ 端口
changeOrigin: true,
pathRewrite: { // 这里记得加上
"^/api": ""
}
}
)
);
}