2

Hey I tried set up express-rate-limit w tRPC but it doesnt work.How can i achive it to work

const test= t.middleware(async ({ next, ctx: { req, res } }) => {
   rateLimit({
      windowMs: 60 * 60 * 1000, // 1 hour
      max: 5,
      message: 'Too many accounts created from this IP, please try again after an hour',
      standardHeaders: true, // Return rate limit info in the `RateLimit-*` headers
      legacyHeaders: false, // Disable the `X-RateLimit-*` headers
   })(req, res, next)
})
IvonaK
  • 119
  • 10

0 Answers0