0
Error: getaddrinfo ENOTFOUND jsonplaceholder.typicode.com/ jsonplaceholder.typicode.com/:80
at errnoException (dns.js:28:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)
我的代碼看起來就像這樣 -節點JS - HTTP模塊錯誤
var test = await new Promise((resolve, reject) => {
var options = {
host: 'jsonplaceholder.typicode.com/',
path: '/posts/1'
};
var req = http.request(options);
req.end();
req.on('connect', (res, socket, head) => {
socket.on('data', (chunk) => {
resolve(chunk.toString());
});
socket.on('end',() => {
proxy.close();
});
});
});
似乎有與端口號的問題,但我想不通,請幫我找出問題。