I’m doing
Url shortener project and i dns.lookup like this
// your first API endpoint...
app.post("/api/shorturl/new", (req, res) => {
let url = req.body.url;
console.log(url);
dns.lookup(url,(err) => {
console.log(err);
res.send('ok');
})
});
and if i send https://www.freecodecamp.org
console.log(err) prints that
{ Error: getaddrinfo ENOTFOUND https://www.freecodecamp.org
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:56:26)
errno: 'ENOTFOUND',
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'https://www.freecodecamp.org' }