LogoRevali

Overview

The server reference — controllers, binding, requests, responses and the request lifecycle.

Revali Server is the code generator that turns your controllers into an HTTP server. It is built into revali, so there is nothing extra to install. To set up a project, start with Getting Started. This section is the reference for everything you write in routes/ and lib/components/.

Request lifecycle#

Each request passes through these stages in order. Every stage is optional and can be scoped to the whole app, a controller or a single endpoint.

graph LR;
    A[Request] --> B[Observer]
    B --> C[Middleware]
    C --> D[Guards]
    D --> E[Interceptors pre]
    E --> F[Pipes + binding]
    F --> G[Your endpoint]
    G --> H[Interceptors post]
    H --> I[Response]

An exception thrown at any stage goes to the nearest matching exception catcher. See Lifecycle Components for the execution order in full and how to write each component.

Where to find things#

You want to…Read
Declare routes and HTTP methods Controllers , HTTP Methods
Read params, query, body, headers, cookies Binding
Validate or convert bound values Pipes
Work with the raw requestRequest
Set status, headers, cookies, or stream a body Response
Serve SSE or WebSockets Server-Sent Events , WebSockets
Share data between components and endpoints Context
Add auth, logging, error mapping or rate limits Lifecycle Components
Configure CORS and required headers Access Control
Change host, port, prefix, DI or shutdown App Configuration