I have a project based on ktor server (backend) an...
# compose-web
j
I have a project based on ktor server (backend) and compose web (frontend) How can I make both modules work together? That is, be able to make calls to ktor server from the frontend and also, be able to show a compose web page when a call is made to a ktor server endpoint That is, show the html generated in compose web Taking into account that there will be several screens in compose web? Will someone please understand this question?
r
What do you mean when you say "compose web"? Usually this term is used for Compose Multiplatform Web which is rendered on canvas and doesn't generate any html.
j
my bad, Yes, I mean Compose Multiplatform Web
What I want to achieve is a web page using Compose Multiplatform Web but also, it is connected to a server using ktor server so that, in each call, the ktor server returns the web files that I created in Compose Multiplatform Web
r
Just put the files as static resources.
j
But a question... Are those files the ones I generate when I create a Kotlin file for Compose?
r
When you run
wasmJsDistribution
task, you will get all needed files in the
build/dist/wasmJs
directory
You can copy them manually to ktor project or create a simple gradle task for that.
j
Ok, I understand, perfect Thank you very much I will be investigating this task to understand it better
@Robert Jaros One question, does this spa support https://ktor.io/docs/server-serving-spa.html does it have support for compose? or is it directly with static files? since looking at the doc, it mentions react, vue, etc. files...
r
Compose Web apps are SPA, just like react or vue.
j
Thanks!!