GauravGupta993 / MERN-Templates

https://mern-templates.vercel.app
0 stars 5 forks source link

Add rate-limiter middleware #13

Closed yashanand167 closed 10 hours ago

yashanand167 commented 23 hours ago

The application currently lacks a rate-limiting middleware which could lead to server overload. Adding rate-limiter can help control the number of request a user can make in a given set of time improving the app's security and stability.

Proposed Solution:

npm install express-rate-limit

import rateLimit from 'express-rate-limit';

const limiter = rateLimit({ windowMs: 1 60 1000, // 1 minute max: 100 // limit each IP to 100 requests per minute });

app.use(limiter);

GauravGupta993 commented 22 hours ago

@yashanand167 Looks good to me. You can work on this issue.

yashanand167 commented 22 hours ago

Sure.