Closed
Description
Sébastien Deleuze opened SPR-14954 and commented
Nested routes API could perhaps be improved. Current syntax is :
subroute(GET("/level1/**"), route(GET("/foo/**"), r -> ok().body(fromObject("foo")))
.andRoute(GET("/bar/**"), r -> ok().body(fromObject("bar")))
.andRoute(GET("/baz/**"), r -> ok().body(fromObject("baz"))
It could be nice to allow to specifying subroute(prefix("/level1")
instead of subroute(GET("/level1/**")
(routing can apply to any method + no need to specify /**
for this use case).
Also the method name subroute
does not seems to be accurate here, especially for specifying the root route. And it would be nice to be able to use a fluent API (RouterFunction
instance method ?) to specify the sub routes, not just with static methods not easy to discover from an API POV.
Issue Links:
- HTTP request pattern matching refinements [SPR-14544] #19112 HTTP request pattern matching refinements ("depends on")
- Provide shortcut methods for routing [SPR-14953] #19520 Provide shortcut methods for routing
- Provide a Kotlin DSL for the functional Web API [SPR-15065] #19631 Provide a Kotlin DSL for the functional Web API
1 votes, 3 watchers