I have installed http-server globally.
I launch it from myDir on localhost port 8080. In myDir I have index.html
Simple and straight-forward example using Express 4.x:
var express = require('express');
var app = express();
var path = __dirname + '/public';
var port = 8080;
app.use(express.static(path));
app.get('*', function(req, res) {
res.sendFile(path + '/index.html');
});
app.listen(port);
This implementation will always respond with index.html if the requested file is not found, and it's almost as simple as using http-server, which lacks this option.