I have tried several ways of serving up a static directory. Here is a simple way I am doing this.
var app = express();
app.all('*', express.static('./public'));
module.exports = app;
// run the server
http.createServer(app).listen(8080);
I have several other configurations like:
app.use('/', express.static('./public'));
There is an index.html file in the public directory that gets served up fine. The only thing in the HTML file is a request for a JavaScript file. When that request gets made, express throws a 301 redirect, and adds a trailing slash.
Here is the HTML:
<script type="text/javascript" src="/dist/bundle.js"></script>
Here is the network request.
Any help is appreciated.