The macros available inside PhoenixMountable.Definition.routes/1.
They mirror Phoenix.Router and Phoenix.LiveView.Router, with paths
relative to the mount path. The mount macro turns them into ordinary
routes of the host router.
routes do
get "/export", MyLib.ExportController, :csv
forward "/api", MyLib.API.Router
scope "/admin" do
pipe_through :admin
live "/settings", MyLib.SettingsLive, :edit
end
live_session :public, host_on_mount: false do
live "/share/:token", MyLib.ShareLive, :show
end
live_session :default, on_mount: [MyLib.Auth] do
live "/", MyLib.HomeLive, :index
end
endLive routes outside a live_session belong to the :default session. A
live session's routes must be declared together.
Route helpers are named after the mount: a route with as: :export gets
the helper <mount name>_export_path, and routes without :as share the
mount's name.
Summary
Functions
A DELETE route to a controller or plug. See Phoenix.Router.delete/4.
Forwards requests under path to a plug, such as a router of the library's
API. See Phoenix.Router.forward/4.
A GET route to a controller or plug. See Phoenix.Router.get/4.
A HEAD route to a controller or plug. See Phoenix.Router.head/4.
A LiveView route. See Phoenix.LiveView.Router.live/4.
A live session of the library.
A OPTIONS route to a controller or plug. See Phoenix.Router.options/4.
A PATCH route to a controller or plug. See Phoenix.Router.patch/4.
Pipes the routes of the scope through pipelines of the library
(PhoenixMountable.Definition.pipeline/2) or module plugs.
A POST route to a controller or plug. See Phoenix.Router.post/4.
A PUT route to a controller or plug. See Phoenix.Router.put/4.
Groups routes under a path. Takes :pipe_through as an option, or call
pipe_through/1 inside.
Functions
A DELETE route to a controller or plug. See Phoenix.Router.delete/4.
Forwards requests under path to a plug, such as a router of the library's
API. See Phoenix.Router.forward/4.
A GET route to a controller or plug. See Phoenix.Router.get/4.
A HEAD route to a controller or plug. See Phoenix.Router.head/4.
A LiveView route. See Phoenix.LiveView.Router.live/4.
A live session of the library.
The host's live session is named after the mount: :default becomes the
mount name, any other session <mount name>_<session>.
Options
:on_mount— hooks of this session, run after the library's.:host_on_mount— whether the host's:on_mounthooks run. Defaults totrue. Usefalsefor public pages, which the host's authentication hooks would otherwise guard.:root_layout— overrides the library's root layout.:layout— the LiveView layout of the session.
A OPTIONS route to a controller or plug. See Phoenix.Router.options/4.
A PATCH route to a controller or plug. See Phoenix.Router.patch/4.
Pipes the routes of the scope through pipelines of the library
(PhoenixMountable.Definition.pipeline/2) or module plugs.
A POST route to a controller or plug. See Phoenix.Router.post/4.
A PUT route to a controller or plug. See Phoenix.Router.put/4.
Groups routes under a path. Takes :pipe_through as an option, or call
pipe_through/1 inside.