HTTP
A Jadpo app answers HTTP requests with routes. A route says which method and URL it answers, what comes in, what goes out, and which action or query runs:
// domains/planning/routes/todos.jadporoutes Todos { prefix: /todos POST / { input: CreateTodo output: TodoView status: SuccessStatus.created run: create_todo(input, current_principal.user) }}
This route answers POST /todos. Jadpo reads a CreateTodo from the
JSON body and checks it, and run: gets it as input. run: calls the
action create_todo for the signed-in user (current_principal.user, see
Who is calling). The
action returns a TodoView, which must be the route's output:, and
status: SuccessStatus.created makes the route answer 201 Created rather
than 200.
A route holds no logic of its own. The work lives in
actions and queries. When the action
fails, the HTTP status comes from the failure's kind, a category such as
not_found (404), never from the route (Kinds).
Every route needs a signed-in caller unless an authentication: line in
the route says otherwise
(Routes: signed in by default).
The topics of this page cover:
- how routes are grouped and matched: Route groups and Paths and placeholders;
- what a route reads and answers: One input and Output and status;
- how long it may run: Time limits;
- what Jadpo writes for you: Health checks, Generated routes, an OpenAPI document for each API, and The public API record, a file in your project that lists each API's routes and fields, so every change to the API shows as a diff of that file.
Markdown for agents: /docs/http.md.Built from Jadpo main at a707efb.