hr.backend
v0.2.0
Published
Backend with offline fallback for HappyRhino
Downloads
13
Readme
hr.backend
Backend with fallback
Installation
$ npm install hr.backend
Documentation
var Backend = require("hr.backend");
var myApi = new Backend({
});
// Handle api method
myApi.defaultMethod({
execute: function(args, options, method) {
return doSomeHttpStuff(method, args);
}
});
// Ask to cache the method "GET:posts"
myApi.addCachedMethod("GET:posts");
// Execute an api call
myApi.execute("GET:posts")
.then(function(results) {
// Results will come from the http server or the cache if offline
});