Created
November 20, 2014 22:44
-
-
Save ctimmins/8e5da29c1d2f442ec3f1 to your computer and use it in GitHub Desktop.
Server Routes
This file contains hidden or 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
/** | |
* Main application routes | |
*/ | |
'use strict'; | |
var errors = require('./components/errors'); | |
module.exports = function(app) { | |
// Insert routes below | |
app.use('/api/bars', require('./api/bar')); | |
app.use('/api/crawls', require('./api/crawl')); | |
app.use('/api/things', require('./api/thing')); | |
app.use('/api/users', require('./api/user')); | |
app.use('/api/yelp', require('./api/yelp')); | |
app.use('/api/uber', require('./api/uber')); | |
app.use('/auth', require('./auth')); | |
// All undefined asset or api routes should return a 404 | |
app.route('/:url(api|auth|components|app|bower_components|assets)/*') | |
.get(errors[404]); | |
// All other routes should redirect to the index.html | |
app.route('/*') | |
.get(function(req, res) { | |
res.sendfile(app.get('appPath') + '/index.html'); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment