How is it possible to enable custom HTTP verbs in an elixir application using the phoenix framework?
I can see how the macros get
, post
etc. are created in https://github.com/phoenixframework/phoenix/blob/master/lib/phoenix/router.ex#L320-L334. However, probably because of the nested macro architecture that is being used, I was not able to implement a custom HTTP verb, say bla
using a router definition like that:
Phoenix.Router.Scope.route Ical.Router, :match, :bla, "/bla", PageController, :bla, []
While not causing an compiler error, a 404 is produced when performing an BLA /bla HTTP/1.1
request.
It does not even work when trying to simulate the GET behaviour with
Phoenix.Router.Scope.route Ical.Router, :match, :get, "/bla", PageController, :bla, []
Any hints on this would be very much appreciated!
Phoenix.Router.Scope.route
is not documented, therefore it is private to the Phoenix webframework. Please don't call private functions, Phoenix can change that at any time and your code will break. Why do you want a custom HTTP verb? There are many trade-offs involved in doing so and therefore it should not be done lightly: programmers.stackexchange.com/questions/193821/… – José Valim