external javascript file is loading on localhost but not on proper server - node.js

When I load my node.js application using localhost, index.html’s script works properly:

<script src="/index.js" defer></script>

On the other hand, when I use render.com to load my app, index.html loads along with the css however the javascript doesn’t and this error appears in the console:

Despite the location of the file being correct as evidenced by local host working, the online host doesn’t. Other htmls that dont use javascipt work though. How would I go about fixing this?

I tried using postman through the server based url (https://blackjack-v7lr.onrender.com/index.js) but that didn’t find the file either only when using localhost did it find it

I have tried also checking if .gitignore has index.js there as this would block render.com from being able to find the file but it is not in .gitignore

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.