npm install resource-api-utils
var ResourceApiUtils = require('resource-api-utils/lib');
var Api = ResourceApiUtils.create('<route-name>');
##Get:
Api.get(id, params).then(function(response) {
//success
}, function(error) {
//error
});
##Post:
Api.post(payload).then(function(response) {
//success
}, function(error) {
//error
});
##Put:
Api.put(id, payload).then(function(response) {
//success
}, function(error) {
//error
});
##Get List:
Api.getList().then(function(response) {
//success
}, function(error) {
//error
});
##Remove:
Api.remove(id).then(function(response) {
//success
}, function(error) {
//error
});
##Custom Get:
Api.customGet(suffix, params).then(function(response) {
//success
}, function(error) {
//error
});
##Custom Delete:
Api.customDelete(suffix, params).then(function(response) {
//success
}, function(error) {
//error
});
##Custom Post:
Api.customPost(suffix, payload, params).then(function(response) {
//success
}, function(error) {
//error
});
##Custom Put:
Api.customPut(suffix, payload, params).then(function(response) {
//success
}, function(error) {
//error
});