PhoenixReplay.Router (PhoenixReplay v0.6.2)

Copy Markdown View Source

Mounts the PhoenixReplay dashboard in a Phoenix router.

defmodule MyAppWeb.Router do
  use Phoenix.Router
  import PhoenixReplay.Router

  scope "/admin" do
    pipe_through [:browser, :require_admin]

    phoenix_replay "/replay",
      on_mount: [{MyAppWeb.UserAuth, :ensure_admin}],
      authorize: MyApp.ReplayAuthorization
  end
end

Options

  • :on_mount — hooks run before the dashboard's own, typically authentication that assigns the current user
  • :authorize — a PhoenixReplay.Authorization module
  • :frame_layout — {module, function} root layout for the replay frame, which renders your recorded views. Defaults to a layout that loads your endpoint's /assets/css/app.css
  • :live_socket_path — your endpoint's LiveView socket path (default "/live")
  • :as — live session name prefix, needed only when mounting the dashboard more than once (default :phoenix_replay)

Summary

Functions

Builds live session names and options for phoenix_replay/2.

Defines the dashboard routes under path.

Functions

__live_sessions__(base_path, opts)

@spec __live_sessions__(String.t(), keyword()) ::
  {atom(), atom(), keyword(), keyword()}

Builds live session names and options for phoenix_replay/2.

Called at router compile time with the dashboard's full path.

phoenix_replay(path, opts \\ [])

(macro)

Defines the dashboard routes under path.