I'm pretty new to Node.js so this is possibly an basic understanding issue, but I'm getting ECONNREFUSED
from a superagent http request when I don't think I should be:
$ curl http://localhost:5000/
{"you": "looking good"}
$ node
> var request = require("superagent");
> var req = request.get("http://localhost:5000/").on('error', function (err) {
console.log("There's an emergency is going on.", err)
}).end(function (data) {
console.log("All is well", data.body)
});
There's an emergency is going on. { [Error: connect ECONNREFUSED]
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect' }
What assumption have I made that is breaking this? I'm actually writing isomorphic JavaScript and the exact same code making the http query on the browser works fine!