Feature: add functions to add + remove dispatch routes#1585
Feature: add functions to add + remove dispatch routes#1585artman41 wants to merge 1 commit intoninenines:masterfrom
Conversation
3218156 to
f68ded1
Compare
|
This changes the route order though? |
|
@essen my thought behind it is that if you already had a match-all dispatch Happy to modify the implementation to put new dispatches at the end if you think that'd be better though |
|
I question the approach. I think if something was to be added it would have to be something more general, like a function that traverses routes and allows inserting/removing routes at any point. Go through the list in order and allow returning |
|
@essen that sounds a lot more involved than the easy MR I had in mind 😉 If you get chance to write up a bit of a detailed idea of what you mean then I'll give it a go 👍 |
|
I wonder if we want to operate on the dispatch list. It's probably better to work on the routes themselves. In a PoC farwest_router module 1 route may get compiled in multiple routes in the dispatch list. This makes it more difficult to write a function that preserves order. Operating on the cowboy_router/farwest_router routes is more appropriate not only in that case but also from a user point of view. Perhaps in Cowboy 3.0 (which IMO should use the farwest_router by default and can keep cowboy_router for compat) the routes should be given directly along with the router module, and the dispatch list hidden internally. Cowboy would call compile itself. Then we could keep the routes around for retrieval and modifications and compile as needed. Then a function that goes over the routes would make sense. |
Adds helper functions to insert & remove dispatch routes at runtime.