import io.ktor.server.application.* import io.ktor.server.cio.* import io.ktor.server.engine.* import io.ktor.server.response.* import io.ktor.server.routing.* fun main(args: Array) { val helloWorldResponse = args.firstOrNull() ?: error("missing arg") val env = applicationEngineEnvironment { envConfig(helloWorldResponse) } embeddedServer(CIO, env).start(true) } fun ApplicationEngineEnvironmentBuilder.envConfig(helloWorldResponse: String) { module { routing(helloWorldResponse) } connector { host = "0.0.0.0" port = 8080 } } fun Application.routing(helloWorldResponse: String) { routing { get("/module1") { call.respondText(helloWorldResponse) } } }