Hello, I am trying something which I'm not sure if...
# kobweb
c
Hello, I am trying something which I'm not sure if it's even the intention to do so 😅 I was experimenting with kobweb in a KMP project (which I created with the KMP wizard), in this project I would like to use a separate ktor server module instead of the internal ktor server in kobweb itself. I managed to get kobweb working inside the
composeApp/jsMain
package. But when trying to run the ktor server (which is located in the package
server
) I was getting errors while compiling and after trying a couple of things I'm not really sure what to do. So my question would mainly be, is it actually possible to create a KMP project with kobweb, android and a separate ktor server? Or is it really mandatory to use the internal ktor from within kobweb itself? If not mandatory, is there somewhere some sort of example that I can try and ascertain where I went wrong or what I missed exactly?
The reason that I want to have a separate ktor server module, is just so that I can try to learn the basics of ktor itself so I know what it actually does under the hood instead of just getting to know the wrapper that kobweb provides.
Apologies if links are not quite relevant
(kind of a crazy day here so only skimmed! Feel free to ask more questions and I will answer when I have a bit more time)
c
Not a problem, understandable that the holiday period can contain crazy days 😅 Hmm, the links you provided are interesting, I did not notice them at my first read through! Didn't think of just exporting the site and then importing the static files from within ktor itself...! I did also found out what the actual problem was with my setup. My goal was to have 1 KMP project where I could share some code between my different targets. Because of this, my composeApp has the "kobweb application" plugin, and the shared package has the "kobweb library" plugin. My server application was also using the shared module. But because the server isn't a KMP module and does use kobweb I get an error when trying to run the ktor application. Build error for the ktor server:
[ksp] java.lang.IllegalStateException: KobwebProcessorProvider: Missing processor mode (kobweb.mode)
Package setup:
Copy code
project
- composeApp (kobweb application)
    - androidMain
    - iosMain
    - commonMain
    - jsMain
- shared (kobweb library)
    - androidMain
    - iosMain
    - commonMain
    - jsMain
    - jvmMain
- server