@canmertinyo/rate-limiter-core
Version:
A simple rate-limiting middleware for Express.js with support for in-memory, Redis, and MongoDB storage
13 lines (9 loc) • 340 B
text/typescript
import { Request } from "express";
export const getIp = (req: Request): string => {
return req.ip || (req.headers["x-forwarded-for"] as string) || "unknown";
};
export const getTimestamp = (): number => {
return new Date().getTime();
};
export const isFunction = (object: any): boolean =>
typeof object === "function";