withoutclass
12/13/2017, 7:47 PM/**
* An extension method for simplifying coroutines usage with Vert.x Web routers
*/
fun Route.coroutineHandler(fn : suspend (RoutingContext) -> Unit) {
handler { ctx ->
launch(ctx.vertx().dispatcher()) {
try {
fn(ctx)
} catch(e: Exception) {
ctx.fail(e)
}
}
}