Skip to content

Instantly share code, notes, and snippets.

@savelee
Created August 16, 2016 13:28
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 savelee/85df49e74ee8824f07de5e67a1be2cc6 to your computer and use it in GitHub Desktop.
Save savelee/85df49e74ee8824f07de5e67a1be2cc6 to your computer and use it in GitHub Desktop.
server/routes.js
'use strict';
var path = require('path');
var errors = require('./components/errors');
module.exports = function (app) {
// All undefined asset routes should return a 404
app.route('/:url(app|components)/*')
.get(errors[404]);
// All other routes should redirect to the index.html
app.route('/*')
.get(function (req, res) {
res.sendFile(path.join(app.get('appPath'), 'index.html'));
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment