Skip to content

Latest commit

 

History

History
122 lines (87 loc) · 1.34 KB

README.md

File metadata and controls

122 lines (87 loc) · 1.34 KB

Resource Api Utils

Installation

npm install resource-api-utils

Uses

var ResourceApiUtils = require('resource-api-utils/lib');

var Api = ResourceApiUtils.create('<route-name>');

Requests

##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
});