How do i start auto reload? Im confused whether I ...
# ktor
a
How do i start auto reload? Im confused whether I am not running it properly or it's because of this bug that it isn't working for me I am on a kotlin multiplatform project, jvm target:
./gradlew demo:jvmRun -Pio.ktor.development=true -t
a
Because of the bug it does not work with embeddedServer. You must use EngineMain. Please note that staticResources wont work anyway.
Besides that… you need to do a continuous graldew build and a separate jvmRun with development mode on per the docs
a
so you are saying that continuous should be on build and NOT on run?
what does static resources mean? I just change the html returned by my server and i dont see the changes. I change the string returned by
call.respondText()
and I don't see the changes. I tried separating the building and running like this:
Copy code
./gradlew demo:jvmRun -Dio.ktor.development=true

./gradlew demo:build -t
it's a lot of things that dont play well in this. I made it work on a jvm module. but had to use the following workaround:
Copy code
embeddedServer(
    factory = Netty,
    port = port,
    host = "0.0.0.0",
    module = Application::module
).start(wait = true)
but when i tried to use this from a multiplatform module, it just stopped working. gave up
a
The above setup should work with Ktor prior to version 3.2.0 on the JVM.
a
@Aleksei Tirman [JB] does it work on multiplatform project? my setup is like this:
Copy code
- app (setups routing and contains html that i want to be able to quickly preview. depends on `backend`)
- backend (uses ktor internally and exposes an api for app to use)
@Aleksei Tirman [JB] I just created a new ktor app using https://kmp.jetbrains.com/?server=true&includeTests=false run it using
./gradlew :server:run
(mentioned in readme) and it nothing happens when i change the route and save the changes. even tried hardcoding 'debug = true' on the build.gradle.kts
Copy code
kotlin = "2.2.10"
ktor = "3.2.3"
a
So, this is the bug as has been mentioned already a few times before. 3.2.3 has a regression. And another thing. It only triggers a reload when you do a request. You wont see a reload just by starting a server, changing something, and doing nothing.
a
Found this issue. Turns out autoreload doesnt work on multi module projects