Ask coding questions

← Back to all posts
Issue with my website
maxina

So in my website, I have a folder with an html file and a js file. For some reason, when I run it, and go to the website, it take my html code and puts it in the js code for some reason.

Any idea of why this would happen?

Answered by Coder100 [earned 5 cycles]
View Answer
Voters
maxina
Comments
hotnewtop
Coder100

please send the repl

maxina

@Coder100
in the games folder i have an index.html file and js file when you run the code and go in inspect element in sources, youll see it puts the html code in the js file and gives and error
https://replit.com/@maxina/chat-example#games/index.html

Coder100

@maxina

here is why

you never handled the case when it was games/main.js and always served the index.html by default.

Try using express.static like this:

maxina

@Coder100 do i just replace that with the app.get code that i have?

maxina

@Coder100 Hello?

Coder100

well
if you want @maxina

Coder100

you could make it all inside that one folder, but yes @maxina

maxina

@Coder100 oh ok i got it now it works

thanks!

and thanks a lot for thanking me im a newby to web development lol

maxina

@Coder100
https://chat-example.maxina.repl.co/games/
my p5 sketch is up and running now!

Coder100

nice!
mark as correct answer? @maxina

maxina

@Coder100 yep there you go

VulcanWM

Where’s the code?

maxina