I am stuck on getting a macro to generate a plug route. I’ve tried many different combinations, read Phoenix and Plug’s code to figure out how to do it, but there is something I am missing.
If I have:
defmodule MyApp.Helper do defmacro __using__() do quote do use Plug.Router plug(:match) plug(:dispatch) get("/hello", do: Plug.Conn.send_resp(conn, 200, "hello")) end end end
defmodule MyApp.Router do use MyApp.Helper match(_, do: send_404(conn)) end
__using__ is undefined, and compilation fails, which lets me think
get was somehow not recognized?