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

@anglr/rest

v14.0.0

Published

Angular module representing rest services

Downloads

155

Readme

npm version Build status

Angular Rest Client

Angular HTTP client to consume RESTful services. Built on @angular/http with TypeScript.

Description

  • Module with decorators to make class RESTfull
  • TODO - add description

Installation

npm install @anglr/rest --save

SystemJs Usage

In your SystemJs configuration script add following lines to packages configuration section:

packages:
{
    '@anglr/rest': 
    {
        main: "dist/index.min.js",
        defaultExtension: 'js'
    }
}

Webpack Usage

This depends on your preferences, but you can use it as any other angular module, just use it in code and webpack will automatically add it to result .js file.

Usage

config/global.json

{
    "apiBaseUrl": "api/",
    "defaultApiHeaders": 
    {
        "Accept": "application/json"
    }
}

user.interface.ts

export interface User
{
    id?: string;
    name?: string;
    surname?: string;
    birthDate?: moment.Moment;
}

export interface Paging
{
    from?: number;
    to?: number;
}

user.service.ts

import {Injectable} from '@angular/core';
import {RESTClient, GET, POST, Path, Body, Query, BaseUrl, DefaultHeaders, Produces, ResponseType, ResponseTransform, LocationHeaderResponse} from '@anglr/rest';
import {isPresent} from '@jscrpt/common';
import {User, Paging} from './user.interface';
import {Observable} from 'rxjs';
import global from 'config/global';
import moment from 'moment';

/**
 * Service used to access User REST resource
 */
@Injectable()
@BaseUrl(global.apiBaseUrl)
@DefaultHeaders(global.defaultApiHeaders)
export class UserService extends RESTClient
{
    //######################### public methods #########################

    /**
     * Gets available users by specified criteria
     */
    @Produces(ResponseType.Json)
    @ResponseTransform()
    @GET("users")
    public getAll(@Query("surname") surname: string,
                  @QueryObject paging?: Paging,
                  @Query("name") name?: string): Observable<User[]>
    {
        return null;
    }

    /**
     * Gets specified user by id
     */
    @Produces(ResponseType.Json)
    @GET("users/{id}")
    public get(@Path("id") id: string): Observable<User>
    {
        return null;
    }

    /**
     * Creates new user
     */
    @Produces(ResponseType.LocationHeader)
    @JsonContentType()
    @POST("users")
    public createUser(@Body user: User): Observable<LocationHeaderResponse>
    {
        return null;
    }

    //######################### private methods #########################

    /**
     * Transform response from getAll method
     */
    private getAllResponseTransform(response: Observable<User[]>): Observable<User[]>
    {
        return response.map(result =>
        {
            if(result && result.length > 0)
            {
                result.forEach(user => 
                {
                    if(isPresent(user.birthDate))
                    {
                        user.birthDate = moment(user.birthDate);
                    
                        if(!user.birthDate.isValid)
                        {
                            user.birthDate = null;
                        }
                    }
                });
            }

            return result;
        });
    }
}

API

RESTClient - Angular RESTClient base class.

Properties

  • TODO - constructor properties

Methods

  • getBaseUrl(): string - Returns the base url of RESTClient
  • getDefaultHeaders(): Object - Returns the default headers of RESTClient in a key-value pair
  • requestInterceptor(req: Request): void - Request interceptor for all methods in class
    • req: Request - Http Request that can be intercepted
  • responseInterceptor(res: Observable<any>): Observable<any> - Allows to intercept all responses for all methods in class
    • res: Observable<any> - response that can be intercepted
    • return - returns new response

Class decorators:

  • @BaseUrl(url: string)
  • @DefaultHeaders(headers: Object)

Method decorators:

  • @GET(url: String)
  • @POST(url: String)
  • @PUT(url: String)
  • @DELETE(url: String)
  • @Headers(headers: Object)
  • @JsonContentType()
  • @FormDataContentType()
  • @Produces(producesDef: ResponseType)
  • @ResponseTransform(methodName?: string)
  • @Cache()

Parameter decorators:

  • @Path(key: string)
  • @Query(key: string)
  • @Header(key: string)
  • @Body
  • @QueryObject
  • @PlainBody
  • @ParameterTransform

License

MIT