Skip to main content

Crate amberfork_server

Crate amberfork_server 

Source
Expand description

The serving edge: a loopback-only HTTP server over the layout Document.

This crate is where tokio lives (design doc: engine crates stay sync + pure; the runtime is quarantined to I/O edges). It exposes exactly ONE content endpoint (D12) and binds 127.0.0.1 only, guarded against DNS rebinding (D6). The document is a snapshot: serialized once at bind time, then served as immutable bytes — re-polls are answered with a strong ETag/304 pair, which is all the UI’s disconnect detection needs.

Structs§

Server
A bound-but-not-yet-serving server: bind and serve are split so the caller can print the real URL (OS-assigned port included) before the accept loop starts.

Enums§

ServeError
Everything that can go wrong at the serving edge, typed so the CLI can phrase each case.

Constants§

DOCUMENT_ROUTE
The one content endpoint (D12): the versioned view-model document, whole.
PAYLOAD_ROUTE
Expand-on-demand (issue #30): POST a SlotAddress taken from a truncated slot on the document, get its full text back. A second route rather than a query string on the first — a SlotAddress’s field-diff path can contain arbitrary characters, and it already has a Serialize/Deserialize impl the web painter can round-trip verbatim without inventing an encoding of its own.