I am writing a small http server using Elixir Plug and having some trouble understanding how its parser works. I cannot figure out how to access the result of the parser in my router. I currently have
...
plug Plug.Parsers, parsers: [:json],
json_decoder: Poison
plug :match
plug :dispatch
forward "/admin" , to: VoucherSite.Admin.AdminRouter
...
And in the admin router I want to access the parsed result from the Parser called above
put "/user" do
...access result here...
respond(conn, {:ok, ""})
end
It feels like I am missing something obvious but all I have access to is conn
which is the connection so no idea how to get the parsed body from the request.