router

Allow to create easily a WebMvc.fn RouterFunction with a Reactive router Kotlin DSL.

Example:

@Configuration
class RouterConfiguration {

@Bean
fun mainRouter(userHandler: UserHandler) = router {
accept(TEXT_HTML).nest {
(GET("/user/") or GET("/users/")).invoke(userHandler::findAllView)
GET("/users/{login}", userHandler::findViewById)
}
accept(APPLICATION_JSON).nest {
(GET("/api/user/") or GET("/api/users/")).invoke(userHandler::findAll)
POST("/api/users/", userHandler::create)
}
}

}

Author

Sebastien Deleuze

Arjen Poutsma

Since

5.2