13 lines
514 B
JavaScript
13 lines
514 B
JavaScript
import rateLimit from 'express-rate-limit';
|
|
import { config } from '../config.js';
|
|
export const createBoardLimiter = rateLimit({
|
|
windowMs: 60 * 60 * 1000, // 1 hour window
|
|
max: config.rateLimitMaxBoardsPerHour, // max 5 boards per IP per hour
|
|
standardHeaders: true,
|
|
legacyHeaders: false,
|
|
message: {
|
|
error: 'Rate Limit Exceeded',
|
|
message: `You have reached the limit of ${config.rateLimitMaxBoardsPerHour} boards per hour. Please wait before creating another board.`,
|
|
},
|
|
});
|