libero/ssr
Helpers for server-side rendering with Libero.
Server-side: call a dispatch handler directly, encode flags for the HTML document, and render the full page shell.
Client-side: read and decode flags embedded by the server.
Types
Values
pub fn call(
handle handle: fn(state, BitArray) -> #(
BitArray,
option.Option(error.PanicInfo),
state,
),
state state: state,
module module: String,
msg msg: msg,
) -> Result(payload, SsrError)
Call a dispatch handler directly on the server, returning the decoded response payload. Encodes the call envelope, invokes the handler, strips the wire framing, and unwraps the result.
pub fn decode_flags(
flags: dynamic.Dynamic,
) -> Result(a, SsrError)
Decode flags from a Dynamic value (base64 ETF string). Use this in a Lustre init function to decode server-embedded flags.
pub fn document(
title title: String,
body body: String,
flags flags: String,
client_module client_module: String,
) -> String
Generate a complete HTML document with a pre-rendered body, embedded flags, and a client module import.
pub fn encode_flags(data: a) -> String
Encode a value as a base64 ETF string, ready to embed in HTML as client flags.