Reputation:
i'm trying to send a request for my localhost, from my localhost like this:
http.get
host: 'localhost:3000'
path: '/events'
, (response) ->
console.log response
This is causing this error:
Error: getaddrinfo ENOTFOUND localhost:3000:80 localhost:3000:80:80
at errnoException (dns.js:26:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:77:26)
I can't figure it out why is happening and how to fixed. Can't i send requests for the same server?
Thanks.
Upvotes: 0
Views: 1678
Reputation: 225164
localhost:3000
isn’t a host; it’s a host and a port. Pass them as separate properties.
http.get
host: 'localhost'
port: 3000
path: '/events'
, (response) ->
console.log response
Upvotes: 1