BB.LiveView.Router (bb_liveview v0.2.3)

View Source

Provides router helpers for mounting the BB Dashboard.

Usage

In your Phoenix router:

import BB.LiveView.Router

scope "/" do
  pipe_through :browser
  bb_dashboard "/robot", robot: MyRobot
end

The dashboard can be mounted multiple times at different paths for different robots:

bb_dashboard "/arm", robot: ArmRobot
bb_dashboard "/base", robot: BaseRobot

Options

  • :robot - Required. The robot module to control. Must define a robot/0 function.

Authentication

Protect the dashboard using standard Phoenix pipelines:

pipeline :admin do
  plug MyAppWeb.RequireAdmin
end

scope "/admin" do
  pipe_through [:browser, :admin]
  bb_dashboard "/robot", robot: MyRobot
end

Summary

Functions

Defines routes for mounting the BB Dashboard at the given path.

Functions

bb_dashboard(path, opts)

(macro)

Defines routes for mounting the BB Dashboard at the given path.

See the module documentation for usage examples.