Closed
Description
Sébastien Deleuze opened SPR-14953 and commented
Currently, we declare routes like that:
route(GET("/foo/**"), r -> ok().body(fromObject("foo")))
.andRoute(GET("/bar/**"), r -> ok().body(fromObject("bar")))
.andRoute(POST("/baz/**"), r -> ok().body(fromObject("baz")))
This is a very common use case that deserves IMO syntactic sugar to make routes more readable and maintainable. Something like:
routeGet("/foo/**", r -> ok().body(fromObject("foo"))
.andRouteGet("/bar/**", r -> ok().body(fromObject("bar"))
.andRoutePost("/baz/**", r -> ok().body(fromObject("baz"))
That will still allow to use the current more powerful/evolutive API while providing some nice shortcuts for this kind of code that application developers will have to write so many times.
Issue Links:
- Improve nested routes API [SPR-14954] #19521 Improve nested routes API
1 votes, 3 watchers