Pim
01/07/2025, 10:49 AMparentCoroutineContext
from the ApplicationEnvironment.parentCoroutineContext
. In ktor3 ownership was changed to `Application`; however, now the property is val
.
Let’s say I want my server to run on a certain coroutine. Should I wrap the embeddedServer().start()
call in a withContext
? Or is there another way to accomplish this?Aleksei Tirman [JB]
01/08/2025, 9:56 AMparentCoroutineContext
using an overload of the embeddedServer
method which accepts ServerConfig
:
embeddedServer(Netty, serverConfig {
parentCoroutineContext = Dispatchers.Default
module {
routing {
get {
call.respondText("Hello World!")
}
}
}
}).start(wait = true)
Pim
01/08/2025, 10:54 AM