ECONNREFUSED when making GET request in app, but API returns JSON successfully. Try this (inserting the full path url) in the get method:
1 2 3 4 5 6 7 8 9 10 11 | 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; } }); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.