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

Hook to rate limit requests to 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();
}