I am using node.js 'request' module for making http request. This code worked for the first time. But now it shows some error.
var request = require('request');
request('http://www.google.com', function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
} else {
console.log(error);
}
})
Error:
{ [Error: getaddrinfo ENOTFOUND www.google.com]
code: 'ENOTFOUND',
errno: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'www.google.com' }
I cannot understand why this is happening. My internet works fine and I can open google.com in my browser.