Added rate limiting logic in middleware.

This commit is contained in:
K
2025-07-18 01:17:53 +05:30
parent d5d1e16d1f
commit 25cfa659c7
+11
View File
@@ -0,0 +1,11 @@
const rateLimit = require("express-rate-limit");
const loginLimiter = rateLimit({
windowMs: 15 * 60 * 1000, // 15 minutes
max: 5, // limit each IP to 5 login requests per windowMs
message: "Too many login attempts. Try again in 15 minutes.",
standardHeaders: true,
legacyHeaders: false,
});
module.exports = { loginLimiter };