Created
August 31, 2019 13:10
-
-
Save digimon1740/b3bf69afabbf9d4ad153d128c75e6937 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.digimon.demo.router | |
| import com.digimon.demo.handler.TodoHandler | |
| import org.springframework.context.annotation.Bean | |
| import org.springframework.context.annotation.Configuration | |
| import org.springframework.web.reactive.function.server.RequestPredicates.path | |
| import org.springframework.web.reactive.function.server.RouterFunctions.nest | |
| import org.springframework.web.reactive.function.server.router | |
| @Configuration | |
| class TodoRouter(private val handler: TodoHandler) { | |
| @Bean | |
| fun routerFunction() = nest(path("/todos"), | |
| router { | |
| listOf( | |
| GET("/", handler::getAll), | |
| GET("/{id}", handler::getById), | |
| POST("/", handler::save), | |
| PUT("/{id}/done", handler::done), | |
| DELETE("/{id}", handler::delete)) | |
| } | |
| ) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment