Files
react/demo/proxy/setupProxy.js
T
2022-08-14 13:42:24 +08:00

15 lines
393 B
JavaScript

/*
* @Author: chenxuan
* @Date: 2022-02-15 22:14:04
* @LastEditTime: 2022-02-15 22:15:54
* @LastEditors: chenxuan
*/
const proxy = require('http-proxy-middleware')
module.exports = function(app) {
app.use(
proxy('/api', { //`api`是需要转发的请求
target: 'http://www.baidu.com/', // 这里是接口服务器地址
changeOrigin: true,
})
)
}