https://kotlinlang.org logo
Title
g

Gunslingor

08/11/2020, 1:17 PM
Is there a better way to make the front end kotlinJS talk to the backend Ktor than this:
Guess not?
Here is a tip: assign a type to remove the ?
val content = document.getElementById("content") as HTMLElement
a

andylamax

08/11/2020, 4:34 PM
You code is not communication with the backend. Your ktor sever spits out
html
Then the
js
takes it from the client side and munipulate the
dom
Maybe you mean something different when you say you need
frontend
to communicate to the
backend
g

Gunslingor

08/11/2020, 4:35 PM
You are correct... It's just a little ugly. Wondering if there is a better approach
s

spand

08/13/2020, 1:52 PM
Not sure there is a better way to hydrate the frontend but at least you can do
document.getElementById("content") ?: error("Couldnt find content element")
for better errors
g

Gunslingor

08/13/2020, 1:55 PM
That's an excellent suggestion, thanks, any others =) ...