throttled
Express.js Middleware to Throttle Requests. Supports clustering using redis.
Usage
/** * Configure the middleware * * @type */var throttled = /** * Redis Prefix * * @type */ prefix: 'throttled:' /** * How many requests to limit per period * * @type */ limit: 1000 /** * How long before the count resets in seconds * * @type */ period: 60 * 15 /** * How long should someone be banned in seconds if they exceed the limit * * @type */ ban: 15 * 60 /** * Should we use the console, a custom logger, or nothing at all * * @type */ logger: console /** * Redis options. Read more about them at * https://github.com/mranney/node_redis#rediscreateclient * * @type */ redis: {}; /** * Can be applied to your entire server */app; /** * Or a specific route */app;