代理代码是这样的:
const proxy = require('http-proxy-middleware');
// import proxy from 'http-proxy-middleware';
module.exports = function (app) {
app.use(
proxy('/api', {
target: 'http://localhost:9781/',
changeOrigin: true,
pathRewrite: {
'^/api': ''
}
})
);
};
请求的 URL:http://localhost:3000/api/login
但没有跳转到我代理的URL上
求大佬解疑