Expand description
Axum middleware for Forma SSR.
Provides page rendering (render_page), content-hashed asset serving,
CSP headers with cryptographic nonces, service worker handling, and
the Phase 1 (client mount) / Phase 2 (SSR reconcile) rendering pipeline.
§Quick Start
use forma_server::{render_page, PageConfig, RenderMode};§Serving a page
PageOutput’s html and csp are a single unit — the HTML embeds a
per-request nonce that only that policy blesses. Send them together with
Cache-Control: no-store (see PageOutput::headers) and never cache the
HTML across requests.
Re-exports§
pub use csp::build_csp_header;pub use csp::generate_csp_nonce;pub use csp::CspNonce;pub use csp::InvalidNonce;pub use ir_compat::load_ir_modules;pub use ir_compat::load_ir_modules_strict;pub use ir_compat::IrLoadError;pub use template::render_page;pub use template::render_page_with_nonce;pub use types::*;
Modules§
- assets
- Serving content-hashed files out of the embedded
distdirectory. - csp
- Content-Security-Policy construction and nonce generation. CSP nonce generation and policy construction.
- ir_
compat - Loading and version-checking the per-route
.irmodules at startup. - sw
- The service-worker response and its headers.
- template
- The HTML page template and the SSR render entry points.
- types
- Request/response types: page config, manifest, render mode.
Structs§
- Bytes
- Re-exported because it appears in
assets::asset_bytes’s signature. A cheaply cloneable and sliceable chunk of contiguous memory.