15 lines
393 B
JavaScript
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,
|
|
})
|
|
)
|
|
} |