While utilizing Express, I have encountered an issue where JavaScript allows me to access images, but when trying to directly implement an image route in the src attribute like
<img src="images/background.png">
The localhost indicates that it is unable to retrieve the image.
I have set up a static route pointing to /public
in the server.js
file. It's puzzling why some images can be received while others cannot.
This is the current line defining the public route:
app.use(express.static('public'));