is there an example project where backend code and...
# javascript
c
is there an example project where backend code and javascript frontend use the same kotlin data classes?
c
in the first link the backend and frontend are separate gradle projects and in the second link its one project. what is more common?
s
@christophsturm – we even have a long hands-on tutorial about doing something like this: https://play.kotlinlang.org/hands-on/Full%20Stack%20Web%20App%20with%20Kotlin%20Multiplatform/01_Introduction – using Kotlin/Multiplatform
c
nice. that handson also uses one gradle project, instead of separate subprojects for backend, frontend, common. is that the recommended way?
r
yes
separate subprojects were used in the previous version of kotlin mpp
it still can be used this way, but as far as I know the recommended way is to use separate source sets in a single project
t
If you need test your JS app locally (run webpack dev-server) - separate subprojects - single solution
c
is there also an example where the frontend is in typescript or javascript and just uses kotlin data classes and maybe some shared code?
f
Hi @Sebastian Aigner, I like this project structure design but only available in Kotlin MPP. ¿Any equivalent in Kotlin/JS?
@frank
f
thx @Sebastian Aigner, but it's not the same. I like approach of Project structure in kotlin MPP: One Project module with multiples sourceSets by platform. e.g: src/<platform>/kotlin My project has 3 modules backend (Node), webapp (browser) and common and I wanted to split by SourceSet not by modules.
I found the equivalent for Kotlin/JS using
creating
instead of
getting
e.g:
Copy code
val backend by creating{}
val webapp  by creating{}
@Sebastian Aigner, With this approach, Have you found any limitations in Jetbrains projects?
c
@Sebastian Aigner if i update the react wrappers to the latest dependency the hands on no longer builds.
s
That’s not supposed to happen, @christophsturm ! Could you share some extra information about the error you’re getting and the version of Kotlin and Wrappers you are using?
c
I’m using the latest wrappers and i had to make this change to fix it:
Copy code
-        child(functionalComponent = App)
+        child(App)
i noticed it because i copied this line to my own project which used the latest wrappers and there it did not work. then i tried updating the wrappers in the hands on and it failed too
`org.jetbrainskotlin react16.13.1-pre.107-kotlin-1.3.72`is what I’m using
s
Thanks for noticing! Indeed, the API has changed since the tutorial has last been updated. I’ll create an issue and adjust it :)