Rate limiter middleware for qoq based on koa-ratelimit.
yarn add qoq-ratelimit
import { WebSlotManager, createConfig } from 'qoq';
import { RateLimit, RateLimitOptions } from 'qoq-ratelimit';
const options = createConfig<RateLimitOptions>({
driver: 'memory',
});
export const webSlots = WebSlotManager.use(new RateLimit(options));
import { WebSlotManager, createConfig } from 'qoq';
import { RateLimit, RateLimitOptions } from 'qoq-ratelimit';
import Redis from 'ioredis';
const options = createConfig<RateLimitOptions>({
driver: 'redis',
db: new Redis(),
});
export const webSlots = WebSlotManager.use(new RateLimit(options));
@see koa-ratelimit