libero/codegen_dispatch

Server-side dispatch generator.

Emits dispatch.gleam from a list of handler endpoints. The generated module pattern-matches incoming wire envelopes onto handler function calls and produces ETF-encoded responses.

Values

pub fn write_endpoint_dispatch(
  endpoints endpoints: List(scanner.HandlerEndpoint),
  server_generated server_generated: String,
  atoms_module atoms_module: String,
  context_module context_module: String,
  wire_module_tag wire_module_tag: String,
) -> Result(Nil, gen_error.GenError)

Generate a dispatch module from handler endpoint functions. Each public function with a HandlerContext parameter becomes an RPC endpoint.

Search Document