View Source Flames.Router (flames v0.7.2)

Provies LiveView routing for the Flames dashboard.

Link to this section Summary

Functions

It expects the path the dashboard will be mounted at and a set of options.

Link to this section Functions

Link to this macro

flames(path, opts \\ [])

View Source (macro)

It expects the path the dashboard will be mounted at and a set of options.

This will also generate a named helper called live_dashboard_path/2 which you can use to link directly to the dashboard, such as:

<%= link "Dashboard", to: live_dashboard_path(conn, :home) %>

Note you should only use link/2 to link to the dashboard (and not live_redirect/live_link, as it has to set its own session on first render.

options

Options

  • :live_socket_path - Configures the socket path. it must match the socket "/live", Phoenix.LiveView.Socket in your endpoint.
  • :csp_nonce_assign_key - an assign key to find the CSP nonce value used for assets. Supports either atom() or a map of type %{optional(:img) => atom(), optional(:script) => atom(), optional(:style) => atom()}

examples

Examples

defmodule MyAppWeb.Router do

use Phoenix.Router
import Flames.Router

scope "/admin", MyAppWeb do
  # Define require_admin plug to ensure public users cannot get here
  pipe_through [:browser, :require_admin]

  flames "/errors"
end

end