Created
August 20, 2014 03:41
-
-
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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