Skip to content

Instantly share code, notes, and snippets.

@deedubs
Last active December 10, 2015 22:58
Show Gist options
  • Save deedubs/4505744 to your computer and use it in GitHub Desktop.
Save deedubs/4505744 to your computer and use it in GitHub Desktop.
Catch-all for single page apps
// Catch-all for HTML5 content serving.
router.use(function (req, res, next) {
if (req.accepts(['text/html','application/json']) == 'text/html')
res
.sendfile('public/index.html', {maxAge: 60000});
else
next();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment