Routes
HTTP endpoints with @RouteController, Route<T>, APIRoute<T>, SSERoute<T>, Page, and ServerCall.
Route Types
| Base Class | Response | Use Case |
|---|---|---|
Route<T> | JSON-serialized T | Standard REST endpoints |
APIRoute<T> | JSON with structured errors | Public API endpoints |
SSERoute<T> | Server-Sent Events stream | Real-time streaming (AI chat, progress) |
Page | Server-rendered HTML (JTE) | Web pages |
Defining a Route
kotlin
@RouteController
| Parameter | Default | Purpose |
|---|---|---|
path | — | URL pattern |
method | GET | GET, POST, PUT, DELETE, PATCH, HEAD |
authentication | OPTIONAL | NONE, REQUIRED, OPTIONAL |
SSE Routes
kotlin
ServerCall
Reading requests
Writing responses
Path Parameters
kotlin
Authentication: Routes vs. GraphQL
Routes declare auth at the route level (NONE/REQUIRED/OPTIONAL). GraphQL declares it per-field via parameter nullability (AuthenticationContext vs AuthenticationContext?).
Both use the same underlying auth middleware chain.