https://kotlinlang.org logo
#ktor
Title
# ktor
s

Shalaga44

09/05/2020, 1:42 AM
Hi, I'm newbie trying to use KMP to build a full stack web app using Ktor in jvmMain as back-end and Kotlin-React in jsMain as front-end, How can I add all jsMain source set to ktor watch path to enable automatic reload .
Copy code
fun main() {
    embeddedServer(
        Netty, watchPaths = listOf("jvmMain"), port = 8080,
        module = Application::myModule
    ).start(wait = true)
}
Copy code
fun Application.myModule() {
    routing {
        get("/") {
            call.respondHtml(HttpStatusCode.OK, HTML::index)
        }
        static("/static") {
            resources()
        }
    }
}
n

Nikky

10/04/2020, 5:07 PM
i recommend to run the gradle task that builds the js output with
-t
and have ktor server that folder in dev env (check for folder existance when setting up the routes)
❤️ 1
2 Views