Server

~import orisha/index

Orisha — the contract.

lib/index.k · 10 tors

Orisha — the contract. · 34 more lines
Orisha — the contract. Everything Orisha declares lives here, and nothing in this file is Zig, so there is no parser to switch out of and not a single `~` anywhere. The Zig that implements it — the socket calls, the request parser, the router transform — sits in the companion `index.kz` beside this file. Same stem, same module: the compiler merges them. That split is the whole reason this file reads the way it does. These declarations used to live inside 1,056 lines of Zig, which forced a `~` onto every one of them; the character was never about the Koru, it was about the host language it was sharing a file with. Public API: orisha:serve(port) - Start server (calls abstract handler for each request) orisha:handler - Abstract event users implement for request handling orisha:router(req) - Pattern-branch router transform orisha:static(name, root, ...) - Declare static files to embed at compile time orisha:static-router(name) - Transform: inline static file lookup + fallback Example (simplest server): ~orisha:handler -> { status: 200, body: "Hello!", content_type: "text/plain" } ~orisha:serve(port: 3001) Example (API + static): ~orisha:handler = orisha:router(req) ! [GET /api/health] -> { status: 200, body: "ok", content_type: "application/json" } ! [*] |> orisha:static-router(name: "site") Example (pure static site): ~import orisha ~orisha:static(name: "site", root: "build", fallback: "200.html") ~orisha:handler = orisha:static-router(name: "site") ~orisha:serve(port: 3000)

handler

abstractretain lib/index.k:76

release-body

lib/index.k:114

router

comptimetransform lib/index.k:168

static

comptime lib/index.k:183

static-router

comptimetransform lib/index.k:197