I have a server in Express.js. I would like to do curl request to some sites, to e.g. calculate external links. How can I do it? Here is a part of the code:
app.post("/check", function(req, res) {
console.log(req)
var link = req.body.url;
console.log(link)
// console.log(url);
request(link, function (error, response, body) {
if (!error && response.statusCode == 200) {
res.json({ body: body });
}
});
});
But for some sites I get this error:
Error: getaddrinfo ENOTFOUND
How can I resolve the problem?