Skip to content

Instantly share code, notes, and snippets.

@AntonFagerberg
Last active June 28, 2017 14:35
Show Gist options
  • Save AntonFagerberg/2b0e2759d2e03f3948d9 to your computer and use it in GitHub Desktop.
Save AntonFagerberg/2b0e2759d2e03f3948d9 to your computer and use it in GitHub Desktop.
Elixir Plug form parser
defmodule Router do
use Plug.Router
plug Plug.Parsers, parsers: [:urlencoded, :json],
pass: ["text/*"],
json_decoder: Poison
plug :match
plug :dispatch
post "test" do
IO.inspect conn.params # <-- Map with params
send_resp(conn, 200, "ok :)")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment