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 🙏

© 2024 – Pkg Stats / Ryan Hefner

angular-hu

v1.1.0-alpha1

Published

Angular http utilities

Downloads

76

Readme

Angular HTTP Utils Build Status Coverage Status

Angular $http utilities to deal with common problems when accessing backends

Use cases

You want to...

  • httpu.caches: Save caches to localstorage to allow returning users to read from them; limit the amount of data stored instead of the number of requests; entries to expire after some time; compress the data to allow more request to be cached in the 5MB storage that the browsers are giving; resize your caches with new options for returning visitors.
  • httpu.composite: Your app access several Backends, and have some backend specific interceptors (Authorization, error management...) for each one; You have interceptors that implements some plug&play feature, and belongs to a certain module; You download your templates from your server, and query a different API backend using several interceptors
  • httpu.urlbuilder: You have a backend that doesn't understand the current param serialization from angular, and you have to code the serialized url directly in the url used for the request, losing the power of having it as a plain object.
  • httpu.headers: Know the final URL used for your request (this may be computed by $http before leaving to $httpBackend) to delete cache entries, log them...; Wanna collect statistics information for your backend responses accessed over the worldwide clients; You wanna know if the request you performed hit your $http request cache.
  • httpu.cacherp: You have a backend that need variable request parameters, like oauth1 backends, and wanna cache those requests.
  • httpu.oauth1: You have one or severals backends that need oauth1 signed request, with different configurations.
  • httpu.retry: You have several retry strategies based on some backend specific errors.

Install

You can get it from Bower

## add --save to every command to save to your bower.json
# Install specific module
bower install angular-hu-cacherp
bower install angular-hu-retry
bower install angular-hu-oauth1
bower install angular-hu-headers
bower install angular-hu-caches
bower install angular-hu-composite
bower install angular-hu-urlbuilder

Usage

After installing, HTTP Utils files will be available into a bower_components folder, along with its dependencies.

<script type="text/javascript" src="bower_components/angular/angular.js"></script>
<!-- add your specific module -->
<script type="text/javascript" src="bower_components/angular-hu-cacherp/cacherp.js"></script>
<script type="text/javascript" src="bower_components/angular-hu-retry/retry.js"></script>
<script type="text/javascript" src="bower_components/angular-hu-headers/headers.js"></script>
<script type="text/javascript" src="bower_components/angular-hu-urlbuilder/urlbuilder.js"></script>
<script type="text/javascript" src="bower_components/angular-hu-composite/composite.js"></script>

<!-- oauth1 has an external dependency -->
<script type="text/javascript" src="bower_components/oauth-signature-js/dist/oauth-signature.js"></script>
<script type="text/javascript" src="bower_components/angular-hu-oauth1/oauth1.js"></script>

<!-- caches has an external dependency -->
<script type="text/javascript" src="bower_components/lru-cache/lib/lru-cache.js"></script>
<script type="text/javascript" src="bower_components/angular-hu-caches/caches.js"></script>
<!-- ... -->

Add the specific modules to your dependencies, or add the entire lib by depending on httpu

angular.module('myApp', ['httpu.caches', 'httpu.retry', 'httpu.oauth1', ...]);

Each one is now it's own module and will have a relevant README.md in their respective folders

Development

Single test

npm run test

Continuous testing

Will execute karma and watch the files to run the test on every save

npm run watch

Code coverage

npm run coverage

Coding guidelines

npm run lint

LICENSE

The MIT License (MIT)

Copyright (c) 2015 Telefónica I+D - http://www.tid.es