I have the following basic server:
var express = require('express');
var app = express();
app.get('/', function(req, res){
res.sendfile(__dirname + '/public/index.html');
});
app.listen(8081);
In that index.html I have reference to some CSS that are in the same public folder. The route is correct, because if I open the html with the browser I get the correct way, but if I enter through the server (ie localhost: 8081) I get the flat html, without the CSS. What do I have to add in my NodeJS server?
The CSS referenced from index.html
in this way:
<link rel="stylesheet" href="assets/css/main.css" />