Created
October 24, 2014 22:27
-
-
Save j-mcnally/95ddd278c5d51a33867c to your computer and use it in GitHub Desktop.
Is this batshit crazy?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Exq.RouterPlug do | |
require Logger | |
import Plug.Conn | |
use Plug.Router | |
plug :match | |
plug :dispatch | |
def init(options), do: options | |
def call(conn, opts) do | |
namespace = opts[:namespace] || "exq" | |
if (length(conn.path_info) > 0) do | |
if hd(conn.path_info) == namespace do | |
conn = %{conn | path_info: tl(conn.path_info)} | |
conn = super(conn, opts) | |
end | |
end | |
conn | |
end | |
get "/api/queues" do | |
Logger.debug "YOLO" | |
conn |> halt | |
end | |
match _ do | |
Logger.debug "HALP" | |
conn |> halt | |
end | |
end |
Author
j-mcnally
commented
Oct 24, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment