Hello everyone, we are trying to build a (small) ...
# multiplatform
g
Hello everyone, we are trying to build a (small) full stack web application with Kotlin, consisting of • HTTP backend with Rest-Calls on Kotlin/JVM with ktor • SPA Web Frontend with React on Kotlin/JS with ktor client The “new project” wizard “Kotlin Multiplatform | Full-Stack Web Application” creates a nice start for that. But I struggle with adjusting the project to the following needs: 1. be able to start frontend (webpack) and backend (ktor app) both in watch mode so that I have fast feedback. 2. be able to build a fat jar file for redistribution I was able to achieve some of it with these tasks: 1. create an
index.html
in the frontend static folder and remove the route
index
in the backend 2. add a
webpack.config.d
with the
devServer proxy
settings 3. start webpack after the server so that it picks its own port However, there are some things in need of improvement: • the client is still always included in the backend if I run the server. I’d like to have the client only included when I produce a fat jar for production • I cannot start the server in watch mode.
-t
simply does not have any effect • I would like to get rid of the
webpack.config.d
and rather add some type safe config in the gradle build file Can someone help? Or does someone has another project template for this? Thank you for your help
a
Ktor has a reload function: https://ktor.io/docs/auto-reload.html
g
@Arjan van Wieringen, this docu show how to run gradle
build
in watch mode – but that does not work in
run
mode. If I setup accordingly and run
./gradlew -t run
the application launches, even show the paths it will watch on, but does not recompile and restart after a file is changed.
And I have seen, that “new project” wizard “Kotlin Multiplatform | Full-Stack Web Application” generates a setup with configuration in code and not in file. How do I switch modes?