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)

My code look like this -

  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();
      });
    });
});

It seems there is a issue with port number but i can not figure out, Please help me to identify the issue.

1 Answer 1

1

Remove the trailing slash from the host property of your options

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.