Express rate-limitter
Rate limiting middleware for Express applications built on redis
var express =var app =var client =var limitter = app clientapp
API options
path
:String
route path to the requestmethod
:String
http method. acceptsget
,post
,put
,delete
, and of course Express'all
lookup
:String|Array.<String>
value lookup on the request object. Can be a single value or array. See examples for common usagestotal
:Number
allowed number of requests before getting rate limitedexpire
:Number
amount of time inms
before the rate-limited is resetwhitelist
:function(req)
optional param allowing the ability to whitelist. returnboolean
,true
to whitelist,false
to passthru to limitter.
Examples
// limit by IP address// or if you are behind a trusted proxy (like nginx)// by user (assuming a user is logged in with a valid id)// limit your entire app// limit users on same IP// whitelist user amins
License MIT
Happy Rate Limitting!