Hello I have got to configure an express app in an architecture that look like this:
![my architecture][1]
Build
Core/pulse.core/assets/styles/global.css
app.js
Express_app
views/home.jade
controller/routes.js
node_modules
my app.js looks like this:
var express = require('express'),
http = require('http'),
fs = require('fs'),
path = require('path');
var app = express();
html_templates = __dirname + '/Express_app';
app.set('views', html_templates + '/views');
app.set('view engine', 'jade');
app.use("/Core", express.static(__dirname + 'Core/Pulse.Core/Assets/Styles/'));
app.listen(3000, function () {
console.log("express has started on port 3000");
});
require('./Express_app/controller/routes.js')(app);
in my home.jade file, i have:
link(rel="stylesheet", href=levelarbo+"../../Core/Pulse.Core/Assets/Styles/global.css")
My html is loading fine, however, i am getting a 404 for my css file, please help. I have been stuck on this for hours :(
app.use("/Core", express.static(__dirname + 'Core/Pulse.Core/Assets/Styles/'));
Should be (note the location of the /
)...
app.use("/Core", express.static(__dirname + '/Core'));
The casing in the URL should match the casing in the file system. If the actual path is Core/pulse.core/assets/styles/global.css
, the jade file should read...
link(rel="stylesheet", href=levelarbo+"../../Core/pulse.core/assets/styles/global.css")