proxyTable: {
'/api': {// '/api':匹配项
target: 'http://192.168.10.183:8103',// 接口的域名
// secure: false,// 如果是https接口,需要配置这个参数
changeOrigin: true,// 如果接口跨域,需要进行这个参数配置
// pathRewrite: {// 如果接口本身没有/api需要通过pathRewrite来重写了地址
// '^api': ''
// }
}
}
const development = {
frontend: {
port: WEB_PORT,
index: path.resolve(__dirname, './client/dist/index.html'),
assetsRoot: path.resolve(__dirname, './client/dist'),//封装好的文件
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {
'/api/aaa': {
target: 'http:*********',
changeOrigin: true,
pathRewrite: {
'^/api/aaa': '/api'
}
},
'/api/ccc': {
target: 'http:******',
changeOrigin: true,
pathRewrite: {
'^/api/ccc': '/api'
}
},
'/api/guard': {
target: 'http://******',
changeOrigin: true,
pathRewrite: {
'^/api/guard': '/api'
}
},
'/api/safm': {
target: SEND_SMS,
changeOrigin: true,
pathRewrite: {
'^/api': '/'
}
},
'/api/bstar': {
target: BSTAR_PROXY_API,
changeOrigin: true,
pathRewrite: {
'^/api/bstar': '/api'
}
},
'/api':{
target:PROXY_API
}
},
cssSourceMap: false
},
上面这些代码不用说,都是在config.js里面的
下面跟给位大佬说说env, 不知道给位大佬怎么用这个env文件的,
# NODE_ENV=production
NODE_ENV=development
WEB_PORT=9009
PROXY_API= http://*******
# wangshenzhao
men = http://******
#HAO_GE
#http://********
#yinpin
YIN_PIN= http://*********
#menjin
GUARD_API=http://*******
#shuxing
SHU_XING=http://**********
# 发送短信ip
SEND_SMS = http://**********
# 访问北京的服务接口
BSTAR_PROXY_API = http://*********