Serving static files in express
Hello everyone, sorry to disturb you. I have a question regarding
app.get(express.static()).
Let's say we have a folder named public, and the path to this folder is passed as an argument. We noticed that if we have a stylesheet in this folder, the link to it in the HTML file doesn't need to be changed. When the server is running, the CSS is still parsed correctly. However, if we try to open the HTML file directly using the local server VS Code extension, it doesn't work.
Could anyone explain why this happens please.2 Replies
u should probably show what u r saying
Notice that our link doesn't contain the public folder but our server is still correctly serving the file but if we try to open the HTML file with live server for e.g, we won't have access to the style sheet because it is incorrectly being referenced