[WIP] Allow Router to handle additional HTTP verbs/methods#1234
[WIP] Allow Router to handle additional HTTP verbs/methods#1234iStefo wants to merge 1 commit intophoenixframework:masterfrom
Conversation
In the __before_compile__ macro, Phoenix.Router can retrieve additional http methods and create the macros just as with the stock methods.
|
Another approach is to have a |
|
@josevalim I see why it would be desirable to add methods without recompiling phoenix, I can't judge the internal complexity, though. However, creating specific macros that are nicer to use than a generic |
|
@iStefo if we have |
|
👍 on |
|
Alright, as long as it is possible to create the DSL-like macros, I am in for the Do you see any way I can push this forward and help with the implementation? Or are the internals rather complex for a beginner like me? |
Unfortunately the router is the most complex bits of phoenix so it might be a lot to take on, but you are welcome to give it a shot. Otherwise, please open a separate issue and I can take care of it :) |
|
@chrismccord since I have rather little time in the near future to take care of this enhancement, I will gladly open an issue and leave it to people more close to the Router module. |
After a brief discussion in this Stackoverflow thread, I continued trying adding custom HTTP methods to the Phoenix Router.
While this option surely comes as a danger (using custom HTTP methods is generally not a favourable desire), it may be necessary to implement some protocols that extend HTTP with own method names, such as WebDAV/CalDAV.
Allowing the programmer to add custom HTTP methods turned out to be more difficult than I originally thought, because the method macros are being generated at phoenix's compile time, and not the application's. That made it impossible to either use
or
However, the current approach uses the projects config files and by adding this command adds any custom methods as desired by the programmer:
A short list of tasks that came up to my mind:
Please tell me what you think about this addition.