Currently, I am developing an HTML-based game with Node.js, focusing on enhancing the front-end interface. While trying to include a CSS stylesheet, I encountered an unusual issue.
The structure of my folders is organized as follows:
C:\Users\myname\Documents\gamename. Within this directory, there is the app.js file, and under the 'client' folder, resides the index.html file that serves the client. Additionally, within the client folder, the stylesheet 'w3.css' is located.
In the app.js, the line I have written is:
app.use('/client',express.static(__dirname + '/client'));
Inside the index.html file, the line of code for linking the stylesheet is:
<link rel="stylesheet" href='w3.css'>
However, upon running the server, it appears unable to locate the stylesheet. Oddly enough, when opening the html file locally, it manages to find the CSS file successfully.
Any suggestions on how to resolve this issue? I initially utilized the link from W3Schools for reference, but now aspire to customize and incorporate my own parameters.