https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
e

electrolobzik

02/08/2022, 5:54 PM
Hey guys, is it possible to use Compose for Web and have Ktor based backend on the same Netty web server instance? If I follow
<https://play.kotlinlang.org/hands-on/Full%20Stack%20Web%20App%20with%20Kotlin%20Multiplatform>
I get this error: 
The Compose Compiler requires the Compose Runtime to be on the class path, but none could be found
 while compiling jvm target. I have compose dependencies specified only for js target, but it looks like the Compose Plugin is used for jvm and it causes the error. How could I fix that? Are there any sample projects with Compose and Ktor backend working together?
b

Big Chungus

02/08/2022, 5:55 PM
Sure, just have your server and compose-web in separate modules. You can introduce a third module if you want to share some code between them.
Here's a sample setup sharing code between ktor server and compose-web app
e

electrolobzik

02/08/2022, 6:42 PM
@Big Chungus thank you so much!
43 Views