I want to develop server and client web with ktor, but when coding I don’t want to restart application every time. How could I do with this option?
This main application:
fun main(args: Array<String>): Unit = io.ktor.server.netty.EngineMain.main(args)
Kotlin version: 1.3.70
Ktor version: 1.3.2
Thank you!
As that, I need to apply my main function following this block below!
fun main(args: Array<String>) {
embeddedServer(
Netty,
watchPaths = listOf("solutions/exercise4"),
port = 8080,
module = Application::mymodule
).apply { start(wait = true) }
}
fun Application.mymodule() {
routing {
get("/plain") {
call.respondText("Hello World!")
}
}
}
Because my original main block is like that,
fun main(args: Array<String>): Unit = io.ktor.server.netty.EngineMain.main(args)
Yes, I was config it too in application.conf