I'm a beginner with Express and I'm currently trying to incorporate images from the public
directory into my project (the same directory where my CSS files are stored).
Initially, I attempted placing the image files directly in the public
folder, and then I created an images
subfolder within the public directory. However, neither of these methods have been successful so far.
Update:
The issue is that the images aren't displaying when I open the server to view the frontend.
Here's a snippet of my Express code:
app.use(express.static(__dirname + '/public'));
And here's an example of my CSS code:
#photogap {
margin-right: 15%;
margin-left: 5%;
height: 500px;
padding-top: 150px;
background: url("images/photoGapOne.jpg");
background-size: cover;
}
Directory Structure:
Test
public
CSS
images
views