Skip to content

Instantly share code, notes, and snippets.

Created November 8, 2013 21:51
What would you like to do?
Simple server
* Add express to package.json
* Keep the app.get('*') for nice sinlge page app support
var express = require("express"),
app = express(),
port = parseInt(process.env.PORT, 10) || 4567;
app.configure(function() {
app.use(express.static(__dirname + '/app'));
dumpExceptions: true,
showStack: true
// send all non-api requests to our main index.html page, which starts our app
// this is a nice way to support non hash links on single page apps... and why we started using
// angular and genesis in the first place <3
app.get('*', function(req, res, next) {
res.redirect('/#' + req.url);
app.listen(port, function() {
console.log("Express server listening on port " + port);
Copy link

Note if this is not root level, use app.use(express.static(path.join(__dirname, '../app'))); or similar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment