Cov Rate Limit
A lightweight Rate limiter middleware for Express and Koa. Use to limit repeated requests to public APIs.
Install
$ npm install --save cov-rate-limit
Example
Koa
const Koa = const RateLimit = const app = const rateLimiter = app
Express
RateLimit with redis
const express = const RateLimit = const Redis = const redis = Redis const rateLimiter = const app = app const data = data: message: '11111111' list: Array app
Options
type: 'koa' // 'express' CacheKey: 'C0V_RATE:' { return reqip } max: 500 // max requests within duration [500] duration: 1000 * 60 * 15 // of limit in milliseconds [15 * 60 * 1000] setHeader: true cache: redis // redis client [in memory cache] {} // endSender (ctx, next) {}
License
MIT © Awe
inspiration by express-rate-limit