gradle jar
java -jar build/libs/foobar-1.0-SNAPSHOT.jarThen hit port 8080
curl http://localhost:8080/health| // src/App.kt | |
| import io.vertx.core.Vertx | |
| import io.vertx.ext.web.Router | |
| fun main(args: Array<String>) { | |
| val vertx = Vertx.vertx() | |
| val router = Router.router(vertx) | |
| router.get("/health").handler { ctx -> ctx.response().end("OK") } | |
| vertx.createHttpServer().requestHandler(router).listen(8080) | |
| } |
| plugins { | |
| id 'org.jetbrains.kotlin.jvm' version '1.3.72' | |
| } | |
| def vertx_version = "3.9.0" | |
| group 'org.example' | |
| version '1.0-SNAPSHOT' | |
| repositories { | |
| mavenCentral() | |
| } | |
| dependencies { | |
| implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" | |
| compile "io.vertx:vertx-core:$vertx_version" | |
| compile "io.vertx:vertx-lang-kotlin:$vertx_version" | |
| compile "io.vertx:vertx-web:$vertx_version" | |
| } | |
| compileKotlin { | |
| kotlinOptions.jvmTarget = "1.8" | |
| } | |
| compileTestKotlin { | |
| kotlinOptions.jvmTarget = "1.8" | |
| } | |
| sourceSets { | |
| main { | |
| kotlin { | |
| srcDirs = ['src'] | |
| } | |
| } | |
| } | |
| jar { | |
| manifest { | |
| attributes 'Main-Class': 'AppKt' | |
| } | |
| from { | |
| configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } | |
| } | |
| } |