Skip to content

Instantly share code, notes, and snippets.

@nkezhaya
Created September 6, 2020 16:31
Show Gist options
  • Select an option

  • Save nkezhaya/5ae9a9eb946736f92ad9ddcb3286945f to your computer and use it in GitHub Desktop.

Select an option

Save nkezhaya/5ae9a9eb946736f92ad9ddcb3286945f to your computer and use it in GitHub Desktop.
defmodule MyAppWeb.RouteForwarder do
def init(opts), do: opts
def call(%Plug.Conn{request_path: "/api/" <> _} = conn, opts) do
MyAppWeb.APIRouter.call(conn, opts)
end
def call(conn, opts) do
MyAppWeb.Router.call(conn, opts)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment