Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ng-http-rate-limiter

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng-http-rate-limiter

$http rate limiting in Angular

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

Rate limit $http calls in Angular

ng-http-rate-limiter allows you to limit calls to particular URL patterns such that they only occur under a maximum rate per second. If you issue calls faster than that, the rate limiter will delay calls to maintain the chosen rate. You can configure multiple rate limiter configs, each of which match a different URL pattern and maintain their own queue.

This code was extracted from Destiny Item Manager, and is intended for use with Angular 1.

NPM version Bower version Build Status

Usage

ng-http-rate-limiter is available for use directly, via AMD (RequireJS), or in NodeJS. It is installable as ng-http-rate-limiter from either NPM or Bower.

var myModule = angular.module('myapp', ['ngHttpRateLimiter']);

myModule
  .config(["ngHttpRateLimiterProvider", function(rateLimiterConfigProvider) {
    // No more than one request to slowdomain.com every second
    rateLimiterConfigProvider.addLimiter(/slowdomain.com/, 1, 1000);
    // Send a maximum of three requests in any given 5 second period to a particular API
    rateLimiterConfigProvider.addLimiter(/api.com\/limited-api\//, 3, 5000);
  }])
  .config(["$httpProvider", function($httpProvider) {
    // Install the interceptor
    $httpProvider.interceptors.push("ngHttpRateLimiterInterceptor");
  }]);

Developing

First, install NodeJS however you like for your system (on OSX, I use brew install node).

Then check out and build the project:

npm install -g grunt-cli
git clone https://github.com/bhollis/ng-http-rate-limiter
cd ng-http-rate-limiter
npm install
grunt

License

Copyright (c) 2016 Benjamin Hollis. MIT Licensed, see MIT-LICENSE.txt for details.

Keywords

FAQs

Package last updated on 22 May 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc