Router macros for Dstar pages and components.
# In your Phoenix router:
import Dstar.Router
scope "/", MyAppWeb do
pipe_through :browser
dstar "/counter", CounterPage
dstar_components "/ds", [DetailDrawer, DatePicker]
enddstar/2 expands to plain Phoenix routes — the route is the allowlist:
GET /counter -> Dstar.Page.Plug page (mount + render)
POST /counter -> Dstar.Page.Plug stream (handle_connect + loop)
POST /counter/_event/:event -> Dstar.Page.Plug event (handle_event)_event is a reserved path segment under page paths.
dstar_components/2 expands to one POST route on Dstar.Plugs.Dispatch
with the given module allowlist.
Summary
Functions
Wires a Dstar.Page module: GET render, POST stream, POST events.
Wires Dstar.Component modules (or any handle_event/3 handler
modules) onto a single dispatch route under base.
Functions
Wires a Dstar.Page module: GET render, POST stream, POST events.
Inside an aliased scope, the page module is scope-expanded like a
controller or live view — dstar "/counter", CounterPage inside
scope "/", MyAppWeb resolves to MyAppWeb.CounterPage.
Wires Dstar.Component modules (or any handle_event/3 handler
modules) onto a single dispatch route under base.
Component modules are scope-expanded like controllers.