0.2.0 • Published 9 years ago

hr.backend v0.2.0

Weekly downloads
13
License
-
Repository
github
Last release
9 years ago

hr.backend Build Status

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