Error: getaddrinfo ENOTFOUND in nodejs for get call Error: getaddrinfo ENOTFOUND in nodejs for get call express express

Error: getaddrinfo ENOTFOUND in nodejs for get call


getaddrinfo ENOTFOUND means client was not able to connect to given address.Please try specifying host without http:

var optionsget = {    host : 'localhost',    port : 3010,    path : '/quote/random', // the rest of the url with parameters if needed    method : 'GET' // do GET};

Regarding learning resources, you won't go wrong if you start with http://www.nodebeginner.org/ and then go through some good book to get more in-depth knowledge - I recommend Professional Node.js , but there's many out there.


Check host file which like this

### Host Database## localhost is used to configure the loopback interface# when the system is booting.  Do not change this entry.##127.0.0.1   localhost255.255.255.255 broadcasthost


for me it was because in /etc/hosts file the hostname is not added