Skip to content

Instantly share code, notes, and snippets.

@denisinla
Created August 20, 2014 03:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save denisinla/539142a9b7d023a6d5b5 to your computer and use it in GitHub Desktop.
Save denisinla/539142a9b7d023a6d5b5 to your computer and use it in GitHub Desktop.
Express server config for backbone SPAs with pushState set to true. (http://stackoverflow.com/a/18553854/1172652)
var http = require('http');
var fs = require('fs');
var express = require('express');
var app = express();
// Read all static files from directory
app.use(express.static(__dirname + '/../app/'));
// Default HTML file for any requests
app.use(function(req,res){
var contents = fs.readFileSync(__dirname + '/../app/index.html');
res.send(contents.toString());
});
app.listen(3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment