I just created a small multiplatform JS/JVM projec...
# javascript
g
I just created a small multiplatform JS/JVM project. It’s a Todo application that shares view rendering and state code. On the client, it uses a basic Redux implementation. Don’t hesitate to comment. https://github.com/gzoritchak/todokotlin
🔥 1
s
How do you make the frontend files available in the backend project ?
g
In this kind of multiplatform project, I use a share directory data (not a good name!). The server must be launched using this directory as the working directory.
I must document and improve that.
👍 2
s
Ok, maybe worth to explicit in the README since that part is not obvious and multiple solutions exist.
👍 1
I am working on that as well on my sample
s
Just curious: why you use old multplatform plugins
kotlin-platform-common
,
kotlin-platform-js
,
kotlin-platform-jvm
instead of new
kotlin-multiplatform
?
g
Well, every time I tried, I faced some bugs. The last one: https://youtrack.jetbrains.com/issue/KT-24463
s
@snrostov How can I change the port used for
./gradlew :frontend:run -t
?
s
@sdeleuze
Copy code
kotlin {
    target {
        browser {
            runTask {
                devServer = devServer.copy(port = 8081)
            }
        }
   }
}
s
Ok thanks
s
Also you can configure proxy to backend:
Copy code
kotlin {
    target {
        browser {
            runTask {
                devServer = devServer!!.copy(proxy = mapOf("/api" to "<http://localhost:8081>"))
            }
        }
Where
<http://localhost:8081>
- backend endpoint
👍 1
@gaetan Ah… Yes, it is annoying IDE issue. But, as described in comments, the actual issue is that project building using IDEA internal build system, not Gradle. Hope it will be fixed in 1.3.50 (cc @yan)
s
For the port, maybe worth a shortcut for easier usage and discoverability?
s
Yes, the DSL should be better designed. It is more like internal feature for now. https://youtrack.jetbrains.com/issue/KT-32016
👍 2
g
@sdeleuze @bashor @snrostov I updated the project. It’s amazing how Kotlin fits well for redux implementation. The project have now coroutines remote calls with error management. We are going to use this architecture for play.data2viz.io.
⏸️ 3
👍🏻 3
I’m in the process of migrating to new mpp and kts but, as always, I find it sooooo painful. I would like to copy/paste some examples and not suffer, reading a lot of doc for every line. 😭
s
@Ilya Goncharov [JB] please help