1# aldebaran-axum
2
3The responses an Aldebaran site makes, over `http` and axum's `Body`. The Worker
4family (workers-rs with its `axum` feature) and the native family (axum on
5tokio) both answer with `http::Response<axum::body::Body>`, so the adapter for
6both is this one crate. The Cloudflare runtime itself is `aldebaran-worker`.
7
8| Item | What it is |
9|---|---|
10| `respond(content_type, cache, body)` | A response whose content type and cache policy are always given. |
11| `html(page, max_age)` | A page; its cache policy always says `no-transform`. |
12| `events(text)` | The text of Datastar events as the answer to a Datastar request. |
13| `event_stream(stream)` | A long-lived Datastar response: each item of a `Stream<Item = String>` is the text of whole events, sent as it arrives. `no-cache`. |
14| `kept_alive(stream, quiet_for)`, `KEEP_ALIVE`, `KEEP_ALIVE_AFTER` | Feature `keep-alive`, for the native family. Sends the comment line `:` plus a blank line whenever the stream has been quiet for 15 seconds, as axum's `Sse::keep_alive` does. |
15| `datastar_script()` | `datastar.js`, from `aldebaran-datastar`. |
16| `asset`, `bundle_or_not_found` | An embedded file with the cache policy its `?v=` earns; the fallback route. |
17| `not_found`, `refused`, `method_not_allowed` | The three plain refusals. |
18| `secure(headers, &Policy)` | The policy's headers on a response; every response leaves through it. |
19| `asked(method, headers, uri)`, `gated(gate)` | A request as `aldebaran-gate` reads it, and what the gate decided as a response. |
20
21A native server streams with `event_stream(kept_alive(stream, KEEP_ALIVE_AFTER))` and enables the
22`keep-alive` feature of this crate. A Worker uses `event_stream` alone: the feature needs tokio's
23clock, which the Workers runtime does not have.