express-rate-limit 7.0.1 → 7.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/changelog.md +8 -0
  2. package/package.json +1 -2
  3. package/readme.md +21 -16
package/changelog.md CHANGED
@@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to
7
7
  [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8
8
 
9
+ ## [7.0.2](https://github.com/express-rate-limit/express-rate-limit/releases/tag/v7.0.2)
10
+
11
+ ### Added
12
+
13
+ - Added `cluster-memory-store` to the readme and made a couple of other minor
14
+ clarifications.
15
+
9
16
  ## [7.0.1](https://github.com/express-rate-limit/express-rate-limit/releases/tag/v7.0.1)
10
17
 
11
18
  ### Added
@@ -362,6 +369,7 @@ Note: 6.5.0 was not released due to CI automation issues.
362
369
 
363
370
  ### Added
364
371
 
372
+ - Support external stores (from version 2.3.0) onwards.
365
373
  - A `limiter.resetKey()` method to reset the hit counter for a particular client
366
374
 
367
375
  ### Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "express-rate-limit",
3
- "version": "7.0.1",
3
+ "version": "7.0.2",
4
4
  "description": "Basic IP rate-limiting middleware for Express. Use to limit repeated requests to public APIs and/or endpoints such as password reset.",
5
5
  "author": {
6
6
  "name": "Nathan Friedly",
@@ -83,7 +83,6 @@
83
83
  "@types/jest": "29.5.4",
84
84
  "@types/node": "20.5.9",
85
85
  "@types/supertest": "2.0.12",
86
- "cross-env": "7.0.3",
87
86
  "del-cli": "5.1.0",
88
87
  "dts-bundle-generator": "8.0.1",
89
88
  "esbuild": "0.19.2",
package/readme.md CHANGED
@@ -34,14 +34,18 @@ The default `MemoryStore` is probably fine.
34
34
 
35
35
  ### API Rate Limit Enforcement
36
36
 
37
- You may want to switch to a different [store](#store), especially if you have
38
- multiple servers or processes (for example, with the
39
- [node:cluster](https://nodejs.org/api/cluster.html) module). Using an external
40
- data store to syhcnronize hits
41
- ([redis](https://npmjs.com/package/rate-limit-redis),
42
- [memcached](https://npmjs.org/package/rate-limit-memcached), [etc.](#store))
43
- guarentees the expected result even if some requests get handled by different
44
- servers/processes or a server is restarted.
37
+ The default `MemoryStore` stores the hit counts for clients in memory, and is
38
+ thus unsuitable for use when running multiple servers or processes.
39
+
40
+ If you have multiple processes on a single server (via the
41
+ [node:cluster](https://nodejs.org/api/cluster.html) module), the
42
+ [`cluster-memory-store`](https://npmjs.com/package/@express-rate-limit/cluster-memory-store)
43
+ will keep them all in sync without needing an external data store.
44
+
45
+ If you have multiple servers, or want to maintain state across app restarts, use
46
+ an external data store such as
47
+ [redis](https://npmjs.com/package/rate-limit-redis),
48
+ [memcached](https://npmjs.org/package/rate-limit-memcached), [etc.](#store).
45
49
 
46
50
  ### Alternate Rate Limiters
47
51
 
@@ -513,14 +517,15 @@ By default, the [`memory-store`](source/memory-store.ts) is used.
513
517
 
514
518
  Here is a list of external stores:
515
519
 
516
- | Name | Description | Legacy/Modern |
517
- | -------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ------------------- |
518
- | [`memory-store`](source/memory-store.ts) | _(default)_ Simple in-memory option. Does not share state when app has multiple processes or servers. | Modern as of v6.0.0 |
519
- | [`rate-limit-redis`](https://npmjs.com/package/rate-limit-redis) | A [Redis](http://redis.io/)-backed store, more suitable for large or demanding deployments. | Modern as of v3.0.0 |
520
- | [`rate-limit-memcached`](https://npmjs.org/package/rate-limit-memcached) | A [Memcached](https://memcached.org/)-backed store. | Legacy |
521
- | [`rate-limit-mongo`](https://www.npmjs.com/package/rate-limit-mongo) | A [MongoDB](https://www.mongodb.com/)-backed store. | Legacy |
522
- | [`precise-memory-rate-limit`](https://www.npmjs.com/package/precise-memory-rate-limit) | A memory store similar to the built-in one, except that it stores a distinct timestamp for each key. | Modern as of v2.0.0 |
523
- | [`rate-limit-postgresql`](https://www.npmjs.com/package/@acpr/rate-limit-postgresql) | A [PostgreSQL](https://www.postgresql.org/)-backed store. | Modern as of v1.1.0 |
520
+ | Name | Description | Legacy/Modern |
521
+ | -------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- |
522
+ | [`memory-store`](source/memory-store.ts) | _(default)_ Simple in-memory option. Does not share state when app has multiple processes or servers. | Modern as of v6.0.0 |
523
+ | [`cluster-memory-store`](https://npmjs.com/package/@express-rate-limit/cluster-memory-store) | A memory-store wrapper that shares state across all processes on a server via the [node:cluster](https://nodejs.org/api/cluster.html) module. | Modern |
524
+ | [`rate-limit-redis`](https://npmjs.com/package/rate-limit-redis) | A [Redis](http://redis.io/)-backed store, more suitable for large or demanding deployments. | Modern as of v3.0.0 |
525
+ | [`rate-limit-memcached`](https://npmjs.org/package/rate-limit-memcached) | A [Memcached](https://memcached.org/)-backed store. | Modern as of v1.0.0 |
526
+ | [`rate-limit-mongo`](https://www.npmjs.com/package/rate-limit-mongo) | A [MongoDB](https://www.mongodb.com/)-backed store. | Legacy |
527
+ | [`precise-memory-rate-limit`](https://www.npmjs.com/package/precise-memory-rate-limit) | A memory store similar to the built-in one, except that it stores a distinct timestamp for each key. | Modern as of v2.0.0 |
528
+ | [`rate-limit-postgresql`](https://www.npmjs.com/package/@acpr/rate-limit-postgresql) | A [PostgreSQL](https://www.postgresql.org/)-backed store. | Modern as of v1.1.0 |
524
529
 
525
530
  Take a look at
526
531
  [this guide](https://github.com/express-rate-limit/express-rate-limit/wiki/Creating-Your-Own-Store)