ECONNREFUSED when making GET request in app, but API returns JSON successfully
Try this (inserting the full path url) in the get
method:
request
.get('http://localhost:3000/api/getStudents')
.set('Accept', 'application/json')
.end(function(err, res) {
if (err) {
console.log("There's been an error: getting students.");
console.log(err);
} else {
return res;
}
});
Check out the documentation for CORS for an example of using absolute urls:
https://visionmedia.github.io/superagent/#cors