I'm currently delving into Node.js and as a total newbie, I haven't been successful in finding a solution. This is my directory structure:
app --> public --> a.jpg & style.css
When I provide access to these files in Express, it's done in the following way:
var express = require("express");
var app = express();
var PORT = 3000;
app.use(express.static("./app/public"));
The CSS file works fine. However, when I try to call the background-image property in the style sheet, it fails to locate the image and apply it. I've attempted the following combinations with no success:
body{
background-image: "../app/public/a.jpg";
background-image: "./app/public/a.jpg";
background-image: "/app/public/a.jpg";
background-image: "/public/a.jpg";
background-image: "./public/a.jpg";
background-image: "/a.jpg";
background-image: "a.jpg";
}
Could someone please guide me in the right direction?