Skip to content

Latest commit

 

History

History
57 lines (38 loc) · 1.27 KB

File metadata and controls

57 lines (38 loc) · 1.27 KB

api

Declare a JSON endpoint.

Kind Keyword
Since 0.1.0
Repeatable yes

Syntax

api <path> [method <verb>] [requires <clause>]

Arguments

Name Type Required
path path yes

Description

An api block defines a JSON-returning HTTP endpoint. Query results and computed values are serialized to JSON automatically. Use api for machine-to-machine integrations or SPA backends; use page for HTML, action for state-changing flows, and fragment for htmx.

Children

Examples

List users as JSON

api /api/v1/users requires auth
  query users: SELECT id, name, email FROM user ORDER BY id

See also

Provenance

Implementation touched after spec. Source code changed on 2026-05-20, but this entity's spec was last edited on 2026-05-08. The description may be out of date.

Spec last touched 5da8498 (2026-05-08)
Source last touched af278bb (2026-05-20)
Source files internal/parser/parser.go