[英]Why nodejs http request doesn't work when accessing a local served express app?
我有一个运行在8082上的快速REST API应用程序。然后,我尝试使用请求从另一个应用程序进行呼叫:
request.post({
url: 'http://localhost:8082/test',
method: 'POST',
json: {
code: 'Hello'
}
}, (err, res, body) => {
console.log(err)
console.log(res)
console.log(body)
})
但是我收到502 Bad Gateway
错误:
<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.10.1</center>
</body>
</html>
看起来像在研究Nginx而不是expressjs吗?
如何强制它查看正在运行的应用程序?
检查其他应用程序代码中的正确端口,或者如果nginx正在侦听该端口,则更改该端口。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.