serinus_rate_limiter 1.0.2 copy "serinus_rate_limiter: ^1.0.2" to clipboard
serinus_rate_limiter: ^1.0.2 copied to clipboard

Hook to rate limit requests in a Serinus Application.

example/lib/example.dart

import 'package:serinus/serinus.dart';
import 'package:serinus_rate_limiter/serinus_rate_limiter.dart';

import 'app_module.dart';

Future<void> bootstrap() async {
  final app = await serinus.createApplication(
      entrypoint: AppModule(), host: '0.0.0.0', port: 3000);
  app.use(RateLimiterHook(maxRequests: 10, duration: Duration(seconds: 10)));
  await app.serve();
}