Your AdonisJS ecosystem, in the loop.
All insights
documentation

Session and Rate Limiting Documentation Updates

· Developer impact : medium

Documentation for AdonisJS has been enhanced with new guidance on flashing custom input errors in sessions and a new dry run mode for rate limiting. The session guide explains how to flash field-specific errors without validation exceptions using `flashInputErrors()`. The rate limiting guide introduces a dry run mode that counts requests exceeding limits without rejecting them, allowing measurement of limits on real traffic before enforcement. The Edge template engine documentation now references flashing input errors, and the events documentation clarifies the `limit:exceeded` event includes a `dryRun` property indicating dry run mode.

What this means for your code

Developers can now flash custom input errors in sessions to improve user feedback without triggering validation exceptions. They can also test rate limits in production-like conditions without blocking users by using the dry run mode. Event listeners for rate limiting should handle the new `dryRun` property to distinguish between actual rejections and dry run notifications.

  • Use `session.flashInputErrors()` to flash custom input errors without validation exceptions.
  • When defining rate limiters, use the `dryRun()` method to enable dry run mode for testing limits.
  • Listen for the `limit:exceeded` event and check the `dryRun` property to differentiate dry run events from actual rejections.
  • Update Edge templates to use the `@inputError` tag for displaying flashed input errors.
  • Consider configuring environment variables to toggle dry run mode for rate limiting dynamically.

Updated documentation

Original sources

AI-generated analysis based on the linked sources. Check the original documentation before changing your application.

Independent ecosystem watch. Sources linked in every insight.Built with AdonisJS · AI-assisted summariesBy Jérémy Chaufourier · chaufourier.fr