Skip to main content

HTTP server

A server with no framework — typed routes in the language itself. Each response carries X-Energy-Joules.

Open in the playground (full editor) →

Walkthrough

  • server Api port=8080: declares an HTTP server — routing is part of the language, not a framework.
  • get and post blocks are handlers; the last expression is the response. respond {status: "ok"} returns a record as JSON.
  • request.body is available in every handler.
  • Responses can carry an X-Energy-Joules header reporting the energy attributed to the handler (from the calibrated cost model).