PhoenixDatastar.PageController (PhoenixDatastar v0.1.14)

Copy Markdown View Source

Controller for rendering the initial PhoenixDatastar page.

Generates session ID, starts GenServer, and renders the initial HTML.

By default, PhoenixDatastar.DefaultHTML is used as the mount template. To customize the wrapper, you can override it:

  1. Globally via application config:

    config :phoenix_datastar, :html_module, MyAppWeb.DatastarHTML

  2. Per-route via the datastar/3 macro:

    datastar "/counter", CounterStar, html_module: MyAppWeb.DatastarHTML

See PhoenixDatastar.DefaultHTML for a custom module example.

Summary

Functions

Mounts a Datastar view.

Functions

mount(conn, params)

@spec mount(Plug.Conn.t(), map()) :: Plug.Conn.t()

Mounts a Datastar view.

Expects conn.private.datastar to contain: