Sitesx v0.11.0 Sitesx.Plug View Source

Stores Sitesx model into private on Plug struct.

A Sitesx.Plug module extracts domain information from request URL or sub queryparameter.

Plug in Router

defmodule MyApp.Router do
  use MyApp.Web, :router

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

    plug Sitesx.Plug
  end
end

Plug in Controller

defmodule MyApp.MyController do
  use MyApp.Web, :controller

  plug Sitesx.Plug
end

Link to this section Summary

Link to this section Functions