express-rate-limit
Advanced tools
Comparing version 2.5.0 to 2.6.0
@@ -20,2 +20,5 @@ 'use strict'; | ||
}, | ||
skip: function (/*req, res*/) { | ||
return false; | ||
}, | ||
handler: function (req, res /*, next*/) { | ||
@@ -49,2 +52,6 @@ res.format({ | ||
function rateLimit(req, res, next) { | ||
if (options.skip(req, res)) { | ||
return next(); | ||
} | ||
var key = options.keyGenerator(req, res); | ||
@@ -51,0 +58,0 @@ |
{ | ||
"name": "express-rate-limit", | ||
"version": "2.5.0", | ||
"version": "2.6.0", | ||
"description": "Basic IP rate-limiting middleware for Express. Use to limit repeated requests to public APIs and/or endpoints such as password reset.", | ||
@@ -44,3 +44,3 @@ "homepage": "https://github.com/nfriedly/express-rate-limit", | ||
"grunt-contrib-watch": "^1.0.0", | ||
"grunt-mocha-cli": "^2.1.0", | ||
"grunt-mocha-cli": "^3.0.0", | ||
"jshint-stylish": "^2.1.0", | ||
@@ -47,0 +47,0 @@ "load-grunt-tasks": "^3.5.0", |
@@ -11,3 +11,3 @@ # Express Rate Limit | ||
Note: this module does not share state with other processes/servers by default. | ||
If you need a more robust solution, I recommend adding the [Redis Store][rate-limit-redis] or checking out [strict-rate-limiter](https://www.npmjs.com/package/strict-rate-limiter) or [express-brute](https://www.npmjs.com/package/express-brute), both are excellent pieces of software. | ||
If you need a more robust solution, I recommend adding the [Redis Store][rate-limit-redis] or checking out [strict-rate-limiter](https://www.npmjs.com/package/strict-rate-limiter), [express-brute](https://www.npmjs.com/package/express-brute), or [rate-limiter](https://www.npmjs.com/package/express-limiter) - all are excellent pieces of software. | ||
@@ -99,2 +99,8 @@ | ||
``` | ||
* **skip**: Function used to skip requests. Returning true from the function will skip limiting for that request. Defaults: | ||
```js | ||
function (/*req, res*/) { | ||
return false; | ||
} | ||
``` | ||
* **handler**: The function to execute once the max limit is exceeded. It receives the request and the response objects. The "next" param is available if you need to pass to the next middleware. Defaults: | ||
@@ -101,0 +107,0 @@ ```js |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11975
95
173