View Source Pow.Extension.Phoenix.Router (Pow v1.0.38)

Handles extensions for the phonix router.

Usage

Configure lib/my_project_web/router.ex the following way:

defmodule MyAppWeb.Router do
  use MyAppWeb, :router
  use Pow.Phoenix.Router
  use Pow.Extension.Phoenix.Router,
    extensions: [PowExtensionOne, PowExtensionTwo]

  pipeline :browser do
    plug :accepts, ["html"]
    plug :fetch_session
    plug :fetch_flash
    plug :protect_from_forgery
    plug :put_secure_browser_headers
  end

  scope "/" do
    pipe_through :browser

    pow_routes()
    pow_extension_routes()
  end
end

Customize Pow extension routes

Pow extension routes can be overridden by defining them before the pow_extension_routes/0 call. As an example, this can be used to change path:

defmodule MyAppWeb.Router do
  use MyAppWeb, :router
  use Pow.Phoenix.Router
  use Pow.Extension.Phoenix.Router,
    extensions: [PowExtensionOne, PowExtensionTwo]

  # ...

  scope "/", PowExtensionOne.Phoenix, as: "pow_extension_one" do
    pipe_through [:browser]

    resources "/pow_extension_one", SomeController, only: [:new, :create]
  end

  scope "/" do
    pipe_through :browser

    pow_routes()
    pow_extension_routes()
  end

  # ...
end

Summary

Functions

A macro that will call the routes function in all extension router modules.

Functions

Link to this macro

pow_extension_routes()

View Source (macro)

A macro that will call the routes function in all extension router modules.