Monitorex.Router
(monitorex v0.6.0)
Copy Markdown
Router macros for embedding the Monitorex dashboard in your Phoenix application.
Usage
defmodule MyAppWeb.Router do
use Phoenix.Router
import Monitorex.Router
scope "/monitorex" do
http_dashboard []
end
end
Summary
Functions
Defines the Monitorex HTTP dashboard routes.
Functions
Defines the Monitorex HTTP dashboard routes.
Options
:live_view— module to use as the dashboard LiveView (default:Monitorex.DashboardLive):layout— root layout module (default:{Monitorex.Layouts, :root}):assets_path— asset mount path (default:"/dashboard-assets"):on_mount— additional on_mount hooks (default:[Monitorex.Authentication]):api_path— API mount path (default:"/api"). Set tonilorfalseto disable the REST API entirely.
Example
http_dashboard live_view: MyApp.CustomLiveThis generates:
live_session :monitorex_dashboard,
root_layout: {Monitorex.Layouts, :root},
on_mount: [Monitorex.Authentication] do
get "/dashboard-assets/*path", Monitorex.Assets, :call
live "/", Monitorex.DashboardLive, :index
live "/:page", Monitorex.DashboardLive, :index
live "/:page/:host", Monitorex.DashboardLive, :index
end
# API routes (outside live_session, no auth)
forward "/api", Monitorex.ApiPlug