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

Handles extensions for the phonix router.

Usage

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

defmodule MyAppWeb.Router do
  use Phoenix.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

Link to this section Summary

Functions

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

Link to this section Functions

Link to this macro

pow_extension_routes()

View Source (macro)

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