Hi guys, I'm playing with <https://github.com/Kotl...
# javascript
l
Hi guys, I'm playing with https://github.com/Kotlin/kotlin-fullstack-sample and I was wondering if there is a way of sharing the model files between backend and frontend
👍 1
k
There's no direct way to do this. We a working on a multiplatform modules which can be shared between backends. For now you can create two projects, one for JVM and one for JS, first one with the real
src
folder, and another one with
src
that is a symlink to the
src
of the first project.
That approach, however, has some problems with refactoring
Another workaround is to use my experimental compiler and framework, which allows to share classes between JVM and JS. The example in Kotlin is here: https://github.com/konsoletyper/teavm-flavour-examples-todomvc This example does not include shared classes, so you can look at the another example (in Java): https://github.com/konsoletyper/teavm-flavour/tree/master/example
Note that my experimental compiler is not maintained by JetBrains officially. It's my spare-time project
l
thanks for the info, I will take a look