Hi everyone, I am newbie to Kotlin. I am trying to...
# react
b
Hi everyone, I am newbie to Kotlin. I am trying to make "clock" in front end React, backend side will be Kotlin. The front part is not rendering on the web page. What might be the issue? Attached my code. I appreciate for any help
c
Do you have a
main
function client-side? You say it's "not rendering", what do you see exactly, is there an error message in the console?
Other than that, your code looks ok 👍
b
There is a main function running on client side. This is my guess. I might be wrong. How can I structure the files? I might structure the files wrong. Attach you can see the structure of files. I apprecaite for your help!
FAILURE "No matched subtrees found" @ /
this is what I am seeing in console
c
What does your
index.html
look like?
(your index.html would make more sense in jsMain than commonMain, but I don't think that causes the issue)
b
image.png
I still can not find the issue where i am doing wrong
this is the entire project
image.png
c
That yellow background doesn't look good. If you hover on it, there's probably some kind of message
What's your index.js? I don't have that
b
this is my index.js look like
When I hover it, it was saying embedded server should reference top level of application
I do not think this is a problem, because my back end is fully working
I am testing whether server is working or not by POSTMAN. I can see the clock is constantly updating in Postman. I assume the problem is somewhere in index.html or index.js
because it does not render anything on the browser
c
Ah, yeah, the server is because the Ktor devs want you to write it like this: https://gitlab.com/opensavvy/formulaide/-/blob/main/backend/src/main/kotlin/Backend.kt#L25 Indeed it's just an IDEA warning, it has no behavior
You never import your Kotlin code in your index.html, so it is never executed
to know the exact name of the file, it's in
build/js/packages/<module name>
b
<script src="clockdeneme1.js"></script>
should it be like that
U11ntitled.png
When i changed it , it is still not rendering anything
c
Can you add a
println
at the start of your main and check the console to see if it gets executed at all?
I think
type="module"
is necessary
b
ssss.png
I can not see the println neither
I also send it to you, I am trying to find where I am doing wrong, I still can not figure it out
clockdeneme1.zip