Skip to content

Instantly share code, notes, and snippets.

@josevalim
Forked from j-mcnally/exq_web_router.ex
Created October 24, 2014 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josevalim/4736faa0849adedcf152 to your computer and use it in GitHub Desktop.
Save josevalim/4736faa0849adedcf152 to your computer and use it in GitHub Desktop.
defmodule Exq.RouterPlug do
import Plug.Conn
use Plug.Router
plug :match
plug :dispatch
get "/queues" do
IO.puts "YOLO"
conn |> halt()
end
match _ do
conn
end
end
defmodule ExqUi.Router do
use Phoenix.Router
pipeline :before do
plug :super
plug Exq.RouterPlug
end
scope "/" do
# Use the default browser stack.
pipe_through :browser
get "/", ExqUi.PageController, :index, as: :pages
end
# Other scopes may use custom stacks.
# scope "/api" do
# pipe_through :api
# end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment