I have a basic HTML index.html with a handful of containers, and I add bootstrap and font awesome folders to the <head> section of the file.
Such as:
<link href="../bootstrap/css/bootstrap.css" rel="stylesheet">
<link href="../bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
<link href="font-awesome/css/font-awesome.css" rel="stylesheet">
Then, I wrote a web.js script to first initialize the server and then add those folders containing static files, in this way:
var express = require('express');
var app = express();
var fs = require('fs');
var buf = fs.readFileSync("index.html");
app.use(express.logger());
app.get('/', function(request, response) {
response.send(buf.toString());
});
app.configure(function(){
app.use(express.static(__dirname + '/assets'));
app.use(express.static(__dirname + '/bootstrap'));
app.use(express.static(__dirname + '/font-awesome'));
});
var port = process.env.PORT || 8080;
app.listen(port, function() {
console.log("Listening on " + port);
});
However when I go to http://localhost:8080 I get 404 errors from GET commands trying to obtain bootstrap.css, etc. Any help? I tried different scripts obtained from stackoverflow but I can't seem to get it right.
thanks!