Request Lifecycle
Understand how an HTTP request flows through the Ever Gauzy API from entry to response.
Overviewโ
Phase 1: Middlewareโ
Express middleware processes the raw request:
| Middleware | Purpose |
|---|---|
helmet | Security headers |
cors | CORS handling |
compression | Response compression |
body-parser | JSON body parsing |
cookie-parser | Cookie parsing |
Phase 2: Guardsโ
Guards determine if the request is authorized:
| Guard | Order | Purpose |
|---|---|---|
TenantPermissionGuard | 1st | Extract and validate tenant |
PermissionGuard | 2nd | Check user permissions |
RoleGuard | 3rd | Check user role (optional) |
FeatureFlagGuard | 4th | Check feature availability |
Phase 3: Interceptorsโ
Interceptors transform request/response:
| Interceptor | Purpose |
|---|---|
TransformInterceptor | Standardize response format |
TimeoutInterceptor | Request timeout handling |
LazyLoadInterceptor | Lazy-load relations |