Skip to content

surajahmed/resource-api-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published