I learned ReactJS and NextJS, but I am having trouble implementing rate-limiting/throttling in NextJS. I want there to be a limit on the number of times the user can access certain requests per period of time.
I learned ReactJS and NextJS, but I am having trouble implementing rate-limiting/throttling in NextJS. I want there to be a limit on the number of times the user can access certain requests per period of time.
exist and answer for that on the next link.
https://github.com/vercel/next.js/discussions/12134#discussioncomment-6792
And for the last alternative, you can add an express library into a nextjs middleware
Update 2022-Jul-13: As of Next.js v12.2.0, middleware is now stable.
In the latest version of nextjs it is possible through https://nextjs.org/docs/middleware even though it is still in beta.
You can find examples here https://github.com/vercel/examples/tree/main/edge-functions
Your specific use case examples: