Basic rate-limiting middleware for Express that slows down responses rather than blocking them outright. Current stable version is 3.1.0, released as part of the express-rate-limit ecosystem. It is built on top of express-rate-limit and uses its stores, providing a familiar API for slowing repeated requests. Key differentiator: it delays requests after a threshold instead of rejecting them, making it suitable for public API endpoints where gradual throttling is preferred over hard blocks. Requires Node >= 16 and Express 4/5. Ships TypeScript types, supports ESM and CJS, and is actively maintained.
npm install express-slow-downVerified import paths — ran on the pinned version, not inferred.
Creates a speed limiter middleware that delays requests after 5 hits within 15 minutes, adding incremental delay.
Change `import slowDown from 'express-slow-down'` to `import { slowDown } from 'express-slow-down'`.Update `delayMs` to be a function returning the delay in ms, and ensure Node version >= 16.
Create separate store instances: `const store1 = new MemcachedStore({ prefix: 'rl:' }); const store2 = new MemcachedStore({ prefix: 'sd:' });`Use the 'skip' function with a custom check instead of 'skipFailedRequests'.
Use named import: `import { slowDown } from 'express-slow-down'`Use: `const { slowDown } = require('express-slow-down')`Replace `delayMs: 1000` with `delayMs: (hits) => hits * 1000` or similar function.
Use a store from express-rate-limit's compatible stores (e.g., rate-limit-memcached) or implement the Store interface.