What would be the best approach in creating a Kotlin backend which responds with a HTML document which should contain also some JS for basic interactivity?
I have Kotlin code which generates a report in HTML (via kotlinx.html) but after the HTML is loaded it is important that some JS is executed which does some final tweaks on the rendered layout (which can only be available in Browser context). There are multiple ways I could do this, and don't know which one is best:
1. Add raw JS in script tag in HTML. I don't want to lose the benefit of working in kotlin for the JS part, but it seems the most simple.
2. Add a separate JS module which generates the JS required and serve that from Ktor and add that in a href in a script tag in the resulting HTML
3. Create a separate JS file in the editor of my choice and add that in the resources and serve that from Ktor and include in script tag in HTML.
4. Any other ideas?