express-rate-limiter-ts
Version:
A powerful, flexible and modern rate limiter middleware for Express.js written in TypeScript.
23 lines (22 loc) • 723 B
TypeScript
import { IRateLimitStore, RateLimitInfo, RateLimitStats } from '../types/rateLimiter';
export declare class DummyStore implements IRateLimitStore {
incr(key: string): Promise<RateLimitInfo>;
get(key: string): Promise<{
count: number;
resetTime: number;
}>;
reset(key: string): Promise<void>;
recordStat(route: string): Promise<void>;
getStats(): Promise<RateLimitStats>;
ban(key: string, seconds: number, reason: string): Promise<void>;
isBanned(key: string): Promise<{
banned: boolean;
}>;
getBanned(): Promise<{
[key: string]: {
banExpiresAt: Date;
reason: string;
};
}>;
unban(key: string): Promise<void>;
}