In the Node js How to restrict the user login attempts individually?

592 Views Asked by At

I'm using express-rate-limit for limiting the API access using this code

 const limiter = limtter({
    windowMs: 60 * 60 * 1000, // 24 hrs in milliseconds
    max: 5,
    message: {
      code: 429,
      message: "You have exceeded the 5 requests in 1-hour limit!",
    },
    standardHeaders: true,
    legacyHeaders: false,
  });

But it is applied to all requests of API affecting all the users once the limit is crossed. How to add limit for the particular user?

0

There are 0 best solutions below