Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import { rateLimit } from 'express-rate-limit';
import { CODES } from '../../utils/errors/codes.js';
import { MESSAGES } from '../../utils/errors/messages.js';
export const RATE_LIMIT_WINDOW = 1 * 60 * 1000; // 1 minute
const RATE_LIMIT = 60; // limit each IP to 60 requests per `window`
export const rateLimiter = rateLimit({
windowMs: RATE_LIMIT_WINDOW,
limit: RATE_LIMIT,
standardHeaders: true,
legacyHeaders: false,
message: {
code: CODES.RATE_LIMIT,
message: MESSAGES.TOO_MANY_REQUESTS,
},
});
|