ck
05/06/2021, 8:52 PMOliver.O
05/06/2021, 9:18 PMfun Application.module() {
install(ContentNegotiation)
routing {
get("/") {
// do stuff
}
static {
resources()
}
}
launch { // launch a background job with application lifetime
while (true) {
delay(1 /* hours */ * 3_600_000 /* milliseconds */)
// do processing
}
}
}
Big Chungus
05/06/2021, 9:28 PMephemient
05/06/2021, 9:29 PMOliver.O
05/06/2021, 9:36 PMDuration
due to API changes between Kotlin 1.4.x and 1.5. The above should work with both.ck
05/06/2021, 9:36 PMRescribet
05/07/2021, 7:01 AMrunBlocking
to enable coroutines for a similar case (event bus connection).