Error: getaddrinfo ENOTFOUND in nodejs for get call

后端 未结 10 753
离开以前
离开以前 2020-11-30 00:24

I am running a web server on node the code for which is given below

var restify = require(\'restify\');

var server = restify.createServer();

var quotes = [         


        
10条回答
  •  孤街浪徒
    2020-11-30 00:44

    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.

提交回复
热议问题