Created
August 16, 2016 13:28
-
-
Save savelee/85df49e74ee8824f07de5e67a1be2cc6 to your computer and use it in GitHub Desktop.
server/routes.js
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
'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