Closed
Description
I have tried the latest Kotlin Coroutines, but I encountered a small issue when using coRouter DSL.
Spring Boot 2.2.0.BUILD-SNAPSHOT, Spring 5.2.0.M1, Kotlin 1.3, Java 8
For the nest
path, I have to append "/" to make it work. Check the source codes here.
@Bean
fun routes(postHandler: PostHandler) = coRouter {
"/posts".nest {
GET("", postHandler::all)
GET("/{id}", postHandler::get)
POST("", postHandler::create)
PUT("/{id}", postHandler::update)
DELETE("/{id}", postHandler::delete)
}
But in my before experience, for nest paths, it should work without a "/" prefix in both annotated controllers and router DSL, example.
fun routes() = router {
"/posts".nest {
GET("", postHandler::all)
GET("{id}", postHandler::get)
POST("", postHandler::create)
PUT("{id}", postHandler::update)
DELETE("{id}", postHandler::delete)
}
}