This is a very basic sample of a nodejs backend written entirely in kotlin. This allows us to harvest all the niceness of Kotlin while also allowing deployment on any lightweight environment of your choice.
This is a multi-module project where most of the modules have been build using dukat but have then been manually tuned to fix the errors in the generated code.
The project code is located in the app
module. Although its in a very initial state it is my intention is to keep adding features into it.
You can either run it with gradle or npm.
./gradlew nodeRun --continuous
or shorter
./gradlew nodeRun -t
Run the following command in one terminal
./gradlew compileProductionExecutableKotlinJs -t
open a second terminal and run
nodemon build/js/packages/app/kotlin/app.js
(I personally like nodemon which can be easily installed and auto-reloads with the changes)
- Add actual code to the
app
rather than the gibberish I wrote so far for testing - Publish the modules (not the app) into mavenCentral in case they are useful
- Possibly improve namings (tbd)
- Hopefully improve gradle configuration, although I think it's not that bad it could probably be improved