REST Data Client
Access your REST data APIs with custom ad-hoc queries that can be cached and reused. This package and its corresponding server component module rest-data-api are inspired by the excellent post HTTP/REST Data APIs on the Panda Strike Blog.
Installation
You will also want to set up rest-data-api to create the APIs you want to access with this module.
Node
npm install rest-data-client
Then in your code:
var RestDataClient = ;
Browser
This package includes a pre-built webpack module for easy inclusion in the browser at dist/rest-data-client.js
.
You can also use RawGit to include the latest version of the module for development or production environments.
Development
https://rawgit.com/neodon/rest-data-client/master/dist/rest-data-client.js
Production
https://cdn.rawgit.com/neodon/rest-data-client/master/dist/rest-data-client.js
Usage
REST Data Client is agnostic to the method you use to make API calls. You only need to give it the url for your rest-data-api setup and define a requestHandler to tell it how to make the calls.
A requestHandler can return a promise or use the resolve
and reject
callbacks passed to it.
jQuery
var restDataClient = apiUrl: '/query' { $; };
Angular
var restDataClient = apiUrl: '/query' { return ; };