Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    breathe-easypublic

    Breathe Easy

    Build Status

    An extensible, JavaScript REST client base class.

    Usage

    Breathe Easy is a barebones set of objects for constructing RESTful JavaScript web service consumers.

    That being said, it also provides an object called Smoother that removes much of the boilerplate involved in constructing a client.

    Basic Usage with Smoother

    Include smoother.min.js and you're good to go.

    Let's say we want to represent GitHub's users api.

    Github = Smoother.new('https://api.github.com');
    Github.register('User', function() {
      this.base('users');
      this.member(function() {
        this.setup(function(username) {
          this.username = username;
        });
        this.base(function() {
          return this.username;
        });
        this.get('gists');
      });
    });
    u = Github.User.new('benastan');
    u.url();
    => https://api.github.com/users/benastan
    u.get().done(function(user) { console.log(user.id); });
    => 588040
    u.gists().done(function(gists) { console.log(gists[0].description); });
    => Stupid simple rails modals.
    

    Sweet damn! An API Consumer in 10 lines.

    Keywords

    none

    install

    npm i breathe-easy

    Downloadsweekly downloads

    6

    version

    0.0.1

    license

    none

    repository

    githubgithub

    last publish

    collaborators

    • avatar