Routes

HTTP endpoints with @RouteController, Route<T>, APIRoute<T>, SSERoute<T>, Page, and ServerCall.

Route Types

Base ClassResponseUse Case
Route<T>JSON-serialized TStandard REST endpoints
APIRoute<T>JSON with structured errorsPublic API endpoints
SSERoute<T>Server-Sent Events streamReal-time streaming (AI chat, progress)
PageServer-rendered HTML (JTE)Web pages

Defining a Route

kotlin

@RouteController

ParameterDefaultPurpose
pathURL pattern
methodGETGET, POST, PUT, DELETE, PATCH, HEAD
authenticationOPTIONALNONE, 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.