# `PhoenixMountable.Routes`
[🔗](https://github.com/hattoriai/phoenix_mountable/blob/v0.2.1/lib/phoenix_mountable/definition.ex#L441)

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
    end

Live 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.

# `delete`
*macro* 

A `DELETE` route to a controller or plug. See `Phoenix.Router.delete/4`.

# `forward`
*macro* 

Forwards requests under `path` to a plug, such as a router of the library's
API. See `Phoenix.Router.forward/4`.

# `get`
*macro* 

A `GET` route to a controller or plug. See `Phoenix.Router.get/4`.

# `head`
*macro* 

A `HEAD` route to a controller or plug. See `Phoenix.Router.head/4`.

# `live`
*macro* 

A LiveView route. See `Phoenix.LiveView.Router.live/4`.

# `live_session`
*macro* 

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_mount` hooks run. Defaults
    to `true`. Use `false` for 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.

# `options`
*macro* 

A `OPTIONS` route to a controller or plug. See `Phoenix.Router.options/4`.

# `patch`
*macro* 

A `PATCH` route to a controller or plug. See `Phoenix.Router.patch/4`.

# `pipe_through`
*macro* 

Pipes the routes of the scope through pipelines of the library
(`PhoenixMountable.Definition.pipeline/2`) or module plugs.

# `post`
*macro* 

A `POST` route to a controller or plug. See `Phoenix.Router.post/4`.

# `put`
*macro* 

A `PUT` route to a controller or plug. See `Phoenix.Router.put/4`.

# `scope`
*macro* 

Groups routes under a path. Takes `:pipe_through` as an option, or call
`pipe_through/1` inside.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
