From f0e64e3da2cb2532661cc2ee10cfe770f3edeea4 Mon Sep 17 00:00:00 2001 From: Bert Jan Schrijver Date: Thu, 5 Oct 2017 20:29:43 +0200 Subject: [PATCH] Add Kotlin example, align formatting of polyglot verticle examples --- .../src/main/groovy/MyFirstGroovyVerticle.groovy | 6 +++--- helloworld/src/main/js/MyFirstJSVerticle.js | 6 +++--- helloworld/src/main/kotlin/MyFirstKotlinVerticle.kt | 11 +++++++++++ 3 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 helloworld/src/main/kotlin/MyFirstKotlinVerticle.kt diff --git a/helloworld/src/main/groovy/MyFirstGroovyVerticle.groovy b/helloworld/src/main/groovy/MyFirstGroovyVerticle.groovy index 4f9a02d..9883259 100644 --- a/helloworld/src/main/groovy/MyFirstGroovyVerticle.groovy +++ b/helloworld/src/main/groovy/MyFirstGroovyVerticle.groovy @@ -1,3 +1,3 @@ -vertx.createHttpServer().requestHandler({ req -> - req.response().end("Hello world from Groovy!") -}).listen(8080) \ No newline at end of file +vertx.createHttpServer() + .requestHandler({ req -> req.response().end("Hello world from Groovy!") }) + .listen(8080) \ No newline at end of file diff --git a/helloworld/src/main/js/MyFirstJSVerticle.js b/helloworld/src/main/js/MyFirstJSVerticle.js index fba55ee..c524d71 100644 --- a/helloworld/src/main/js/MyFirstJSVerticle.js +++ b/helloworld/src/main/js/MyFirstJSVerticle.js @@ -1,3 +1,3 @@ -vertx.createHttpServer().requestHandler(function (req) { - req.response().end('Hello world from JavaScript!'); -}).listen(8080); \ No newline at end of file +vertx.createHttpServer() + .requestHandler(function (req) { req.response().end('Hello world from JavaScript!'); }) + .listen(8080); \ No newline at end of file diff --git a/helloworld/src/main/kotlin/MyFirstKotlinVerticle.kt b/helloworld/src/main/kotlin/MyFirstKotlinVerticle.kt new file mode 100644 index 0000000..c7b9a17 --- /dev/null +++ b/helloworld/src/main/kotlin/MyFirstKotlinVerticle.kt @@ -0,0 +1,11 @@ +import io.vertx.core.* +import io.vertx.kotlin.core.http.HttpServerOptions + +class MyFirstKotlinVerticle : AbstractVerticle() { + + override fun start() { + vertx.createHttpServer() + .requestHandler({ req -> req.response().end("Hello world from Kotlin!") }) + .listen(8080) + } +} \ No newline at end of file