Rate limit SolidStart API routes
Hello! I was wondering how I can implement an API rate limit solution with the SolidStart API routes.
7 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Thanks you for the suggestions, will look into it!
I need a Redis database for this?
I actually want a solution without using any database -
I was thinking of using a
global._
variable that is used to store the IPsbuilt something like this and tested with a limit of 2requests every 2seconds and seems like it works
implemented a little debug message and I think that I'm done
hope it helps anyone-
im back just to say that i found a way cleaner way to do it with this package
https://www.npmjs.com/package/lambda-rate-limiter
npm
lambda-rate-limiter
Simple in-memory rate-limit for Node.. Latest version: 3.0.1, last published: a year ago. Start using lambda-rate-limiter in your project by running
npm i lambda-rate-limiter
. There are 5 other projects in the npm registry using lambda-rate-limiter.(since i use vercel, lambda is my way to go)
and my code is now looking like this