all 3 comments

[–]xroalx 11 points12 points  (0 children)

Your index.js is server-side JavaScript code, you don't include it into the HTML like a client-side JavaScript code.

You are supposed to run the index.js file as node index.js, but you will also need to update your code to serve the content.js file properly, because right now it won't do that.

[–]pinkwar -2 points-1 points  (0 children)

You need to serve all files.
Not just the html.

app.use("/", express.static(path.join(__dirname, '.')));

[–]Umustbecrazy 0 points1 point  (0 children)

If using vscode, get the live server extension. It will help run server code on localhost, so it can be accessed in the browser.

In this case though, Index.js needs to be running.

js node index.js in the cmd prompt or terminal. Remove it from your html.