0.3.0 • Published 8 years ago

react-angular-http-resource v0.3.0

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

React Angular $Http $Resource

React restful and normal http request tools that was converted from angular's $http and $resource it can be used to create restful services easier requests.

Interceptors can be used to intercept error requests and deal with them globally - in-cases of token authentication or something along this line.

##Installation

npm react-angular-http-resource

###HTTP Usage and options:

var HTTP = require('react-angular-http-resource').HTTP;

// set up interceptors or set up default options at the main entrance point
// this will be available throughout the app.
HTTP.setOptions({
  interceptors: {
    responseError: function(response) {
      // auth.removeUserCookie() // you can do something like.
      browserHistory.push('login');
      return response;
    }
  }
});

###Resource Usage:

var resource = require('react-angular-http-resource').resource;

// create a resource using "resource" factory.
var Users = resource('http://domain.com/v1.0/users');

// using the resource to fetch data.
var res =  Users.get( function(data) {
  console.log('data', data);
});
0.3.0

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago

0.0.11

9 years ago