Getting started (HTML can't load JS, CSS or images)

I created a basic HTML file which loads successfully. But for some reason, no JS, CSS or images will load (HTTP 404).

When I look in the Chrome Network tab, I can see the link is ok (ie: “glitch.me/date.js”). The ‘date.js’ file is also in the root of my app folder and the HTML has: .

All my other JavaScript files, CSS and date are the same.

Why doesn’t anything load? Can’t figure it out.

Please share the project name so we can take a look. Thanks!

I cloned the project and stripped it of some sensitive information which I don’t want exposed at this time.

The project can be found here: https://test-22.glitch.me/form/1

The ‘/form/1’ is simply a specification that I must adhere to which is to feed the HTML page via a REST API. As you can see the file is loaded and displayed correctly. But doing F12 in Chrome, the Network tab indicates that all dependent resources (javascript libs) won’t load (HTTP 404).

I tried with an absolute path ‘/date.js’, relational ‘date.js’ and what I was initially trying ‘js/date.js’ (in a folder). But nothing works.

This is my first few days on glitch (having many problems, not too impressed) and just basic knowledge of Node.js with limited experience. I’m assuming all files in the root are served directly from your servers?

Thanks for your help.

Found these two bits of information which seems like what I was looking for:

Will be trying them to see if it works. Although exposing a ‘public’ folder (or a ‘js’, ‘css’ and ‘images’ would be preferred) over adding routing maps in Node.js.

Now I just have to figure out why when I copy files in the Console it never shows up in my project. Same goes with creating directories, etc.

You can run the refresh command in the console after making changes to get the changes to show up in the editor.

With your current setup, your jQuery files should be in a directory called ‘public’ e.g. public/jquery…

We recommend using the editor directly to create files. The console and editor file tree don’t automatically sync. Use the command ‘refresh’ to get the file tree editor to show updates made with the console.

Oh my god! Thanks, the ‘refresh’ command works. I was going absolutely crazy trying to do things and never showing up in my browser.

I wish they would add a few instructions in ‘motd’ to help us out.

Thank you Gareth and Tim for the information about adding public mapping via express.

Issues solved, moving ahead with my project.

1 Like