خرید بک لینک

Vote count: 0

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?

asked 26 secs ago

برچسب: angular $resource get,angular $resource get example,angular $resource get headers,angular $resource get array,angular $resource get url,angular $resource get parameters,angular $resource get all,angular $resource get response header,angular resource get json,angular resource get promise, نویسنده: استخدام کار تاريخ: يکشنبه 11 مهر 1395 ساعت: 21:08

صفحه بندی