[英]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.