Replies: 3 comments 1 reply
-
So I actually removed that a couple weeks back after overhauling the router; at the time was gonna require a bit of refactoring and I was wondering if it would cause more confusion that just forcing people to type out the strings for endpoints. That being said, thinking about it more it seems like it would be some great sugar for defining similar routes. Big fan of the app
.grouped("/todo") { app in
...
}
.controller("/todo", TodoController()) Would love to encourage more contributions so if you're keen to contribute it might be a good way to get your feet wet in the code! It would be a pretty simple PR. Implementation would be nearly identical to how
If not, we'll add it to the roadmap. Thanks for the suggestion! |
Beta Was this translation helpful? Give feedback.
-
I agree that this could be useful. However, I have a small concern that this might require "jumping around" (between the controller and app) to understand how a path is assembled. Having only |
Beta Was this translation helpful? Give feedback.
-
Released in |
Beta Was this translation helpful? Give feedback.
-
Similar to how routes may be grouped using
app.group(middleware: Middleware, configure: (Application) -> Void)
, it would be great to be able to group routes based on a common root path.For example, a
TodosController
could be simplified through something like this:Of course, this would be only one possible API for introducing this feature. Nesting routes might also make sense to better visualize the grouping:
🔗 Prior Art: Vapor
Beta Was this translation helpful? Give feedback.
All reactions