Skip to content

Improve nested routes API [SPR-14954] #19521

Closed
@spring-projects-issues

Description

@spring-projects-issues

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:

1 votes, 3 watchers

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions