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

Martin Harvan

03/29/2023, 12:49 PM
Hi, maybe a stupid question, but I want to serve compose-web from ktor, but I’m unsure how to reference the js+html files in ktor. I have multi project setup in gradle
b

Big Chungus

03/29/2023, 12:53 PM
Follow the config here, it does exactly what you want (with gradle integration and all the other goodies) https://github.com/mpetuska/kamp/blob/kodex/app/server/src/jvmMain/kotlin/config/routing.kt#L73
m

Martin Harvan

03/29/2023, 12:54 PM
this is awesome, thanks!
so it boils down to
Copy code
into("WEB-INF") {
      from(jsBrowserDistribution)
      exclude("**/*.scss")
    }
and then adding it as static content in ktor
b

Big Chungus

03/29/2023, 1:10 PM
Pretty much, but also hooking up task dependencies accross the modules. My setup also supports hosting webapp as both, embedded within ktor as well as standalone.
In short CfW is no different from any other static js webapp (e.g. react) - it's just a bunch of js, html and css in the end
3 Views