Kotlin full stack TodoMVC
Note: I haven't implemented local storage yet. All items are stored in-memory for now.
The code is a full stack Kotlin example, so it consists of two modules:
It is a very simple HTTP server serving requests on a single route (
localhost:9000/). The response is an index page with minimal HTML DOM:
body and a
kotlinc-js directly. Once the page loaded and the
Being a full stack Kotlin example project, the build scripts are also written in Kotlin (
build.gradle.kts). They are mostly in line with the ones from the reference kotlin-fullstack-sample.
kotlin-frontend-plugin is picky when it comes to version numbers and it's not really documented.
Make sure that you use the latest LTS version of Node.js (
v6.11.2 as of writing) and the matching npm release (
0.0.20 you can use the latest
How to run
First, you have to start the backend:
Note: ktor supports automatic reloading, which is configured in the project. This means that you don't have to restart the running application when you make changes, it's enough to recompile the files that you are editing. You have to run compile by hand though (e.g. from IntelliJ), Gradle doesn't pick up changes automatically for now.
Then you can run the frontend with:
./gradlew -t frontend:run
kotlin-frontend-plugin will compile/assemble all resources into a module and start a
webpack server running on: http://localhost:8080/.
webpackunder the hood Hot Module Replacement is available, so as you are editing the Kotlin code Gradle will automatically recompile changes and the plugin will replace modules in the background.