Overview
This page collects 9 code snippets related to middleware for Elysia. Browse below to find the perfect solution for your needs.
Snippets by Category
Middleware
Logger Middleware
HTTP request logging with timing and sensitive data masking
npx hanma add elysia-logger --framework elysia
Rate Limiter
In-memory rate limiting with sliding window algorithm
npx hanma add elysia-rate-limiter --framework elysia
Error Handler
Centralized error handling with custom error classes
npx hanma add elysia-error-handler --framework elysia
Security Headers
Security headers middleware with CSP, HSTS, and more
npx hanma add elysia-security-headers --framework elysia
Request ID
Request ID tracing for distributed systems
npx hanma add elysia-request-id --framework elysia
Compression
Response compression using Bun's native gzip
npx hanma add elysia-compression --framework elysia
Timeout
Request timeout with configurable duration
npx hanma add elysia-timeout --framework elysia
Frequently Asked Questions
How do I implement middleware in Elysia?
Browse the snippets above and select the one that best fits your needs. Each snippet includes installation instructions and usage examples.
Are these snippets production-ready?
Yes, all snippets are designed for production use. Review and adapt to your specific requirements before deployment.
Can I use these with Elysia?
Yes, these snippets are specifically designed and tested for Elysia.