vue文件:
axios.post('/api/nameCheck', {
name: this.ruleForm2.name
})
.then(function (response) {
config/index.js:(target改过本机ip:3000和127.0.0.1:3000均失败)
proxyTable: {
'/api': {
target: 'http://localhost:3000/',
changeOrigin: true,
// pathRewrite: {
// '^/api': ''
// }
}
},
server/app.js:
var users = require('./routes/users');
app.use('/api', users);
routes/users:
router.post('/nameCheck', function(req, res, next) {
return res.send('totally');
});
报错:POST http://localhost:8089/api/nameCheck 504 (Gateway Timeout)
(node后端已打开,用localhost:3000可以正常访问)
[HPM] Error occurred while trying to proxy request /api/nameCheck from localhost:8089 to http://175.8.15x.xx:3000/ (ECONNREFUSED) (https://nodejs.org/api/errors...
(ECONNREFUSED)
(其实昨天还能连接上的,不知道为什么今天就连不上了。。)
请问有具体的解决办法吗?
504 是网关问题 你前端hold不住的 去你的后台