I’m using Vert.x Kotlin. I have something like
class MainVerticle : AbstractVerticle() {
override fun start() {
val router = Router.router(vertx)
router.get(“/helloworld”).handler { ctx → helloWorld(ctx) }
}
private fun helloworld(ctx: RoutingContext) {
ctx.response().putHeader(“content-type”, “text/html”).end(“helloworld”);
}
}
My question is: is there any way to simplify this line:
router.get(“/helloworld”).handler { ctx → helloWorld(ctx) }
In Java the syntax is something like
router.get(“/helloworld”).handler(this::indexHandler);