npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

angular-restclient

v1.3.5

Published

An angularJS rest client with ORM

Readme

Bower version npm version Build Status

angular-restclient

Angular-restclient is a angular module to help you simplify any REST-based WebApp. It abstracts a RESTful (json) backend and gives you a extra layer. With that it's super easy to do any HTTP requests as GET, POST, PUT, DELETE and so on.

Features

  • Configure all endpoints individually
  • Models gives you a whole new flexibility
  • Mocks let you develop even when the backend is not fully ready yet
  • Simple syntax
  • Fully promise based architecture

Getting started

Requirements

  • angular > 1.2.x
  • angular-resource > 1.2.x

Install

You can ether use bower, npm or git-clone to install angular-restclient. We recommend bower.

bower

$ bower install angular-restclient --save

npm

$ npm install angular-restclient --save

HTML

Load angular-resource.js and angular-restclient.js into your HTML page:

<script src="../bower_components/angular/angular[.min].js"></script>
<script src="../bower_components/angular-resource/angular-resource[.min].js"></script>
<script src="../bower_components/angular-restclient/dist/angular-restclient[.min].js"></script>

Load Module

Make your application module depend on the restclient module:

var app = angular.module('myApp', ['ngResource', 'restclient']);

Sample Configuration

The configuration is super simple. This is a sample configuration. We define a baseRoute to the backend with two endpoints users and posts.

app.config(function(apiProvider) {
    apiProvider.baseRoute('http://localhost/api');

    apiProvider.endpoint('users')
        .route('/users/:id/:controller')
        .model('User');
    apiProvider.endpoint('posts')
        .route('/posts/:id')
        .model('Post');
});

Model example

Every endpoint must have a model defined. At first this seems like a lot of work but its worth it. This extra layer gives you a lot of flexibility. For example: When you have to manipulate the RESTful data you can do it once in the model and access it throughout your whole application. Here is a example of a user model:

app.factory('User', function(Model) {
    function User(object) {
    
        this.id = {
            type: 'string',
            save: false
        };
        
        this.firstname = {
            type: 'string'
        };
        
        this.lastname = {
            type: 'string'
        };
        
        this.email = {
            type: 'email'
        };
        
        this.posts = {
            type: 'relation',
            relation: {
                type: 'many',
                model: 'Post'
            },
            save: false
        };
        
        // Map the given object
        this._init(object);
    }

    angular.extend(User.prototype, Model.prototype);

    return User;
});

Make a call

Last we make a call to the backend.

Get all users

app.controller('Ctrl', function(api) {
    api.users.get().then(function(users) {
        $scope.users = users;
    }, function(error) {
        // error handling
    });
});

Get specific user

app.controller('Ctrl', function(api) {
    api.users.get({id: 1}).then(function(user) {
        $scope.users = user;
    }, function(error) {
        // error handling
    });
});

API Documentation

Providers

Factories

Classes

Abstract Classes

Interfaces