So… I started playing with Kotlin/Js a few weeks a...
# javascript
m
So… I started playing with Kotlin/Js a few weeks ago and most of the projects I found where either a bit outdated or not necessary what I was looking for. I wanted a Kotlin project that could compile into a nodejs server you can later upload into any hosting you’d like and most the examples I found were for “browser”. Therefore, in case someone is interested in taking a look or wants to use it as a guide for your projects, here’s the repo I’ve been uploading the work to. All comments are welcome. https://github.com/martofeld/KotlinNodeJsTest Note: The code itself is very (extremely) basic and its in the app module. Most of my time was invested into fighting with the dukat generated files, configurations, and a few other issues non-code related. It is my intention to keep adding code into the project & publishing the libraries I created into mavenCentral in case they can be useful since I couldn’t find anything similar.
🙌 1
a
A quick sample of Kotlin/JS after a lot of fighting with dukat
Haha 😛
j
Just curious, why do you want to compile your server-side Kotlin code to the NodeJS target rather than JVM? The JVM target is more mature, and you can still share multiplatform code with Kotlin/JS clients if you need
c
not the OP but one reason is faster startup times if it's hosted in AWS lambda (or similar).
🙏 2
👀 1
j
I see, that's a good point. Probably not everyone wants to build for GraalVM 😄
v
You can also have a look at my setup-wsl GitHub action, might be similar to what you describe: https://github.com/Vampire/setup-wsl But you will have a hard time publishing to JCenter, as it is dead. (For publishing that is) you should publish to Maven Central instead, or to NPM.
r
@Joffrey: wants to build for GraalVM
I tried building a native-image last week, but that isn’t trivial either (for non-java people at least). First building a ‘fat jar’, then configuring the flags, setting up a reflection.json with some magic contents, and after all that, I got stuck on it being unable to find my
application.conf
and it not accepting a flag for the port either. Would be great to have some ktor to native-image plugin or something (perhaps for getting better in benchmarks as well)
m
@Joffrey it's exactly what Malcom said, i wanted to take full advantage of all kotlin features while being able to have a fast lightweight server that can be deployed almost anywhere and with little hardware specs
👌 1
@Vampire yes! Your project was a big source of information, together with Kvision, doodle and fritz. Also yeah, jcenter was an expression, maven central would be the right place. I’ll edit the message