Skip to content

Instantly share code, notes, and snippets.

@billydh
Created January 8, 2020 08:16
Show Gist options
  • Save billydh/723b06f303065b98358996b9bd283f0d to your computer and use it in GitHub Desktop.
Save billydh/723b06f303065b98358996b9bd283f0d to your computer and use it in GitHub Desktop.
package io.codebrews.dynamodemo
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.http.MediaType
import org.springframework.web.reactive.function.server.RouterFunction
import org.springframework.web.reactive.function.server.ServerResponse
import org.springframework.web.reactive.function.server.router
@Configuration
class Routes(private val customerHandler: CustomerHandler) {
private val logger: Logger = LoggerFactory.getLogger(javaClass)
@Bean
fun route(): RouterFunction<ServerResponse> = router {
("/users").nest {
accept(MediaType.APPLICATION_JSON).nest {
POST("", customerHandler::saveCustomerInformation)
}
GET("/{customerId}", customerHandler::retrieveCustomerInformation)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment