nori/codegen/gleam_routes

Generates server-side route matching as string output.

Produces a Gleam module with a Route union type and a match_route function that pattern-matches HTTP method + path segments.

Values

pub fn generate(
  ir: ir.CodegenIR,
  module_prefix: String,
) -> String

Generates a complete Gleam routes module string from the CodegenIR.

module_prefix is the Gleam module path of the generated output directory (e.g. "generated" for ./src/generated). When non-empty it’s used to emit real imports for the consumer’s types module; when empty a comment hint is produced instead.

pub fn to_pascal_case(name: String) -> String

Convert a snake_case or camelCase string to PascalCase.

pub fn to_snake_case(name: String) -> String

Convert a PascalCase or camelCase string to snake_case.

Search Document