How can I check if a current request is GET or POST?
You can get the method form the connection. Check the Plug.Conn documentation to see all the fields included:
That gets resolved by Phoenix.Router.
get "/pages/:page", PageController, :show
i.e. a GET request is routed to
post "/pages/:page", PageController, :create
a POST request is routed to
PageController.show you know you are dealing with a GET request and in
PageController.create you know you are dealing with a POST request.
get "/pages/:page", PageController, :aaa post "/pages/:page", PageController, :aaa
Why would you route both
If there is any commonality between processing
POST, factor that logic out as separate function(s) that both
PageController.create can use - while maintaining separate contexts of processing a
Re-read my original question.