Hi all, I am writing the custom module plug in my Phoenix app. The plug includes functions in Phoenix.Controller
, i.e put_view
, `render, etc.
I can import Phoenix.Controller
to the plug, but I haven’t saw any courses or tutorial to do it, is it a good practice?
conn
|> put_status(422)
|> put_view(ErrorView)
|> render("422.html")
|> halt()
I also meet the issue to test the plug. It shows me the error:
** (KeyError) key :phoenix_endpoint not found in: %{phoenix_recycled: true, phoenix_template: "422.html", ..,}
Does anyone have experience on it?