Created
January 13, 2020 15:11
-
-
Save gaerfield/199e87599f4ce1d831eb516e1c7ac5f7 to your computer and use it in GitHub Desktop.
using Kscript for a simple ktor-server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env kscript | |
@file:MavenRepository("jcenter","https://jcenter.bintray.com" ) | |
@file:DependsOn("io.ktor:ktor-server-netty:1.2.6") | |
import io.ktor.application.* | |
import io.ktor.http.* | |
import io.ktor.response.* | |
import io.ktor.routing.* | |
import io.ktor.server.engine.* | |
import io.ktor.server.netty.* | |
embeddedServer(Netty, port = 8080) { | |
routing { | |
get("/") { call.respondText("Hello World!", ContentType.Text.Plain) } | |
get("/demo") { call.respondText("HELLO WORLD!") } | |
} | |
}.start(wait = true) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment