Hi folks :wave: I’ve recently started playing wit...
# ktor
p
Hi folks 👋 I’ve recently started playing with Compose WASM and Ktor. I’m trying to use the generated wasm code (from a separate module) and sever it using Ktor. I want the root to serve the SPA created with compose and then have
/api
be served by the ktor app. I’m struggling to find a way to do this. I’ve thought of two options: • Copy the generated code, from Compose KMP, into the ktor module build folder and add it to the sourceset of the configuration. However, I’m not sure what Gradle task I should use to wire this up (I don’t have much experience with ktor) • Alternative, I was thinking if it would be possible to launch both servers (the one generated by ktor and the one by compose) and use a supervisor server/container to route to one or the other. Does any one have a good source regarding how to do something like this? 🙏
a
You could take a look at https://github.com/ktorio/ktor-samples/tree/main/fullstack-mpp, this describes the process for plain kotlin/js, but I think the difference should be minor.
🙏 1
p
Almost got it working. But apparently, the compose gradle plugin applies itself to all the targets. This includes the jvm frontend. https://github.com/JetBrains/compose-multiplatform/issues/1568 Adding the runtime to the backend seems to work, but I guess it’ll be improved in a future release 🤞