Last updated:
0 purchases
shelf rate limiter
Shelf Rate Limiter #
It limits the number of requests made to your backend in a fixed time frame.
Usage #
final memoryStorage = MemStorage();
final rateLimiter = ShelfRateLimiter(
storage: memoryStorage, duration: Duration(seconds: 60), maxRequests: 10);
copied to clipboard
The default values for duration is 60 seconds and maxRequests is 5.
Add it as a middleware inside the handler or any route.
var handler = const Pipeline()
.addMiddleware(logRequests())
.addMiddleware(rateLimiter.rateLimiter())
.addHandler(_echoRequest);
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.