Skip to content

Instantly share code, notes, and snippets.

@denisinla
Created August 26, 2014 01:55
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/8c973835cc8cfa278a0a to your computer and use it in GitHub Desktop.
Save denisinla/8c973835cc8cfa278a0a to your computer and use it in GitHub Desktop.
Express mod for pushstate.
var express = require('express');
var app = express();
app.set('port', (process.env.PORT || 80));
app.use(express.static(__dirname + '/../app'));
app.use(function(req, res) {
var newUrl = req.protocol + '://' + req.get('Host') + '/#' + req.url;
return res.redirect(newUrl);
});
app.listen(app.get('port'), function(){
console.log("App Running" + app.get('port'))
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment