``` @Bean fun apiRouter() = router { ...
# spring
s
Copy code
@Bean
    fun apiRouter() = router {
        method(OPTIONS) { ALLOW_CROSS_ORIGIN_RESPONSE }
        method(POST).nest {
            contentType(APPLICATION_JSON, this@ApiRoutes::myHandler)    
        }
    }
or
Copy code
@Bean
    fun apiRouter() = router {
        method(OPTIONS) { ALLOW_CROSS_ORIGIN_RESPONSE }
        (method(POST) and contentType(APPLICATION_JSON)).invoke(this@ApiRoutes::myHandler)
    }