Has anyone successfully served a Compose Multiplat...
# ktor
k
Has anyone successfully served a Compose Multiplatform web wasm SPA using Ktor? I am attempting it and having a bit of difficulty. Not sure what's the best way of doing this as I haven't been able to find working examples of it online. I have tried pasting the executable from the build directory of the composeApp into the resources folder of the server module, however, using the SinglePageApplication block inside the "/webapp" url doesn't work. Would appreciate some help with it, not sure if I missed something. This is the syntax used:
Copy code
get("/webapp") {
        singlePageApplication {
            useResources = true
            filesPath = "productionExecutable"
            defaultPage = "index.html"
            ignoreFiles { it.endsWith(".txt") }
        }
}
a
Can you check that compiled files are available in the classpath under the
productionExecutable
package?
k
yup @Aleksei Tirman [JB], I have also included a screenshot. Firstly ran the
wasmJsBrowserDistribution
task and then copied the
productionExecutable
from
composeApp/build/dist/wasmJs
into the
server/src/resources
. Was initially trying to configure a Gradle task for doing the copying it but was not successful in doing so. Gotta brush up on my gradle lol