通过nodejs的请求转发到后台,
前端地址:http://localhost:8080 后端地址:http://localhost:8081
在vue.config.js里面配置这个代理(找到config/index.js 配置文件 )
module.exports = {
derServer:{
proxy:{
'/api':{
target:'http://localhost:3000'
}
}
}
}
然后就可以axios.get('/api').then(res=> {})
微信扫一扫
通过nodejs的请求转发到后台,
前端地址:http://localhost:8080 后端地址:http://localhost:8081
在vue.config.js里面配置这个代理(找到config/index.js 配置文件 )
module.exports = {
derServer:{
proxy:{
'/api':{
target:'http://localhost:3000'
}
}
}
}
然后就可以axios.get('/api').then(res=> {})
相关推荐