I made a RestAPI and I have the following in my node.js...
router.route('/accounts')
.get(function(req, res) {
console.log("getted");
});
It is prefixed with api...
app.use('/api', router);
I tested it on PostMan to see if I can make a GET request and it worked using the following...
http://localhost:3000/api/accounts
Now I am trying to do the same thing from my services.js using $resource...
app.factory('Profile', function ($resource) {
var getToken = function(){
var get_account = $resource('http://XXX.XXX.X.XX:3000/api/accounts/:id', {id:'@id'});
get_account.get();
}
return {
getToken: getToken
}
});
But now when I call Profile.getToken() I get the following error...
ionic.bundle.js:25000 GET http://XXX.XXX.X.XX:3000/api/accounts net::ERR_CONNECTION_REFUSED
Any reason why this is happening?
