Making a site using a node app



Hey, im back…again

so i decided to make a site and so i did, using a normal html app that glitch provides. I decided to futher increment the amount of data i could use on my site and decided that it would be cool to link a discord bot to it so i could recieve some info from my bots and use them on the site, so i went ahead and made a hello express app (the one with node and express).
I then proceded to copy the index.html code and paste it in /views/index.html, then i went and made the new files that i needed like /views/about.html, /views/bots.html etc… now im stuck in my index.html file…i go to where you click to be redirected to (example) bots.html and change “bots.html” to “./bots.html” (note that both the files are in the /views/ folder).
on the site i go and click and get an error saying that it cannot find that file…i was confused. i tried many different ways and still nothing… anyone know how to help out?


Hello! Do you have code in your server.js file to serve the bots.html file?


No, i just have the code that automatically gets added and some extra code to make login the discord bot


What would i need to add for it?


Can you share which project this is? Happy to take a look.


Sure thing, name is node-site-test


sorry if the code is bad or noobish; its my first time building a site


No worries! These things can be tricky when you’re just starting out. I took a look at your project, and the fastest way to get things working will be to move your html files to public instead of views. You can even move index.html there, and just change views/index.html in server.js to public/index.html. The express.static on line 14 will server those for you automatically.

Let me know if this works for you!


oh my god, thank you so much! It works indeed! So you know im changing the projects name now for obvious reasons. Thank you again :3


You’re welcome! Happy to help.

closed #11

opened #12