I'm trying to display icons based on a search, but I keep getting a 404 error for http://localhost:3000/static
when I input a value.
My current folder structure looks like this:
Root directory > Public > Icons
and Root directory > index.js
.
In my index.js file for the express server, I've included
app.use("/static", express.static("public/icons"));
to allow access to the icons. However, on the front end, I continue to receive a 404 error stating "Failed to load resource: the server responded with a status of 404 (Not Found)" as mentioned before.
Within my ejs template, I'm trying to render these icons using:
<img alt="" src="/static/ <%= country.icons %>" /> <%= country.name %>
Any suggestions on how to resolve this issue and successfully render the icons?