Caravela.Gen.LiveRoute (Caravela v0.13.3)

Copy Markdown View Source

Pure-string router-snippet renderer — a debugging / legacy helper.

Superseded in v0.12

Caravela-generated apps register routes through the Caravela.Router macro (caravela_routes/1), which expands from the DSL at compile time. The mix caravela.gen.live task prints a one-line hint pointing at that macro instead of a paste-snippet.

This module still renders the old paste-snippet string so scripts and introspection tools that want a textual representation of a domain's router shape can get one. New code should use Caravela.Router directly.

Emits one block per render mode:

  • :live entities get live "/<plural>", <Entity>Live.<Kind> lines under a :browser pipeline scope.
  • :rest entities get caravela_rest "/<plural>", <Entity>Controller (with realtime: true when the entity opts in).

When the domain declares version "v1", the scope prefix shifts to /v1/<context>/... and the web-module alias picks up the V1. segment, matching Caravela.Gen.LiveView's module layout.

Summary

Functions

Return the router snippet covering every entity's frontend mode.

Functions

render(domain)

Return the router snippet covering every entity's frontend mode.

When the domain mixes :live and :rest entities, both blocks are printed. When every entity shares the same mode, only that block is printed. A domain with no entities returns an empty string.