Appearance
Middleware
Middleware lets you add custom logic to requests (auth, CORS, logging, etc.).
Example
ts
// middleware/auth.ts
export default function auth(ctx, next) {
// Check authentication
return next();
}
Built-in Middleware
- CORS
- Auth
- Rate limiting
- Validation
Add your own in the middleware/
directory.
See Authentication.