Reverted back to express 3 style routes

This commit is contained in:
Sahat Yalkabov
2014-06-06 15:23:28 -04:00
parent 1807e9edc7
commit 4c7b0d275b

169
app.js
View File

@@ -111,141 +111,54 @@ app.use(function(req, res, next) {
app.use(express.static(path.join(__dirname, 'public'), { maxAge: week })); app.use(express.static(path.join(__dirname, 'public'), { maxAge: week }));
/** /**
* Primary routes. * Main routes.
*/ */
app.route('/') app.get('/', homeController.index);
.get(homeController.index); app.get('/login', userController.getLogin);
app.post('/login', userController.postLogin);
app.route('/login') app.get('/logout', userController.logout);
.get(userController.getLogin) app.get('/forgot', userController.getForgot);
.post(userController.postLogin); app.post('/forgot', userController.postForgot);
app.get('/reset/:token', userController.getReset);
app.route('/logout') app.post('/reset/:token', userController.postReset);
.get(userController.logout); app.get('/signup', userController.getSignup);
app.post('/signup', userController.postSignup);
app.route('/forgot') app.get('/contact', contactController.getContact);
.get(userController.getForgot) app.post('/contact', contactController.postContact);
.post(userController.postForgot); app.get('/account', passportConf.isAuthenticated, userController.getAccount);
app.post('/account/profile', passportConf.isAuthenticated, userController.postUpdateProfile);
app.route('/reset/:token') app.post('/account/password', passportConf.isAuthenticated, userController.postUpdatePassword);
.get(userController.getReset) app.post('/account/delete', passportConf.isAuthenticated, userController.postDeleteAccount);
.post(userController.postReset); app.get('/account/unlink/:provider', passportConf.isAuthenticated, userController.getOauthUnlink);
app.route('/signup')
.get(userController.getSignup)
.post(userController.postSignup);
app.route('/contact')
.get(contactController.getContact)
.post(contactController.postContact);
app.route('/account')
.all(passportConf.isAuthenticated)
.get(userController.getAccount);
app.route('/account/profile')
.all(passportConf.isAuthenticated)
.post(userController.postUpdateProfile);
app.route('/account/password')
.all(passportConf.isAuthenticated)
.post(userController.postUpdatePassword);
app.route('/account/delete')
.all(passportConf.isAuthenticated)
.post(userController.postDeleteAccount);
app.route('/account/unlink/:provider')
.all(passportConf.isAuthenticated)
.get(userController.getOauthUnlink);
/** /**
* API examples routes. * API examples routes.
*/ */
app.route('/api') app.get('/api', apiController.getApi);
.get(apiController.getApi); app.get('/api/lastfm', apiController.getLastfm);
app.get('/api/nyt', apiController.getNewYorkTimes);
app.route('/api/lastfm') app.get('/api/aviary', apiController.getAviary);
.get(apiController.getLastfm); app.get('/api/steam', apiController.getSteam);
app.get('/api/stripe', apiController.getStripe);
app.route('/api/nyt') app.post('/api/stripe', apiController.postStripe);
.get(apiController.getNewYorkTimes); app.get('/api/scraping', apiController.getScraping);
app.get('/api/twilio', apiController.getTwilio);
app.route('/api/aviary') app.post('/api/twilio', apiController.postTwilio);
.get(apiController.getAviary); app.get('/api/clockwork', apiController.getClockwork);
app.post('/api/clockwork', apiController.postClockwork);
app.route('/api/steam') app.get('/api/foursquare', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getFoursquare);
.get(apiController.getSteam); app.get('/api/tumblr', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getTumblr);
app.get('/api/facebook', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getFacebook);
app.route('/api/aviary') app.get('/api/github', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getGithub);
.get(apiController.getAviary); app.get('/api/twitter', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getTwitter);
app.post('/api/twitter', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.postTwitter);
app.route('/api/scraping') app.get('/api/venmo', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getVenmo);
.get(apiController.getScraping); app.post('/api/venmo', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.postVenmo);
app.get('/api/linkedin', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getLinkedin);
app.route('/api/yahoo') app.get('/api/instagram', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getInstagram);
.get(apiController.getYahoo); app.get('/api/yahoo', apiController.getYahoo);
app.route('/api/stripe')
.get(apiController.getStripe)
.post(apiController.postStripe);
app.route('/api/twilio')
.get(apiController.getTwilio)
.post(apiController.postTwilio);
app.route('/api/clockwork')
.get(apiController.getClockwork)
.post(apiController.postClockwork);
app.route('/api/foursquare')
.all(passportConf.isAuthenticated)
.all(passportConf.isAuthorized)
.get(apiController.getFoursquare);
app.route('/api/tumblr')
.all(passportConf.isAuthenticated)
.all(passportConf.isAuthorized)
.get(apiController.getTumblr);
app.route('/api/foursquare')
.all(passportConf.isAuthenticated)
.all(passportConf.isAuthorized)
.get(apiController.getFoursquare);
app.route('/api/facebook')
.all(passportConf.isAuthenticated)
.all(passportConf.isAuthorized)
.get(apiController.getFacebook);
app.route('/api/github')
.all(passportConf.isAuthenticated)
.all(passportConf.isAuthorized)
.get(apiController.getGithub);
app.route('/api/twitter')
.all(passportConf.isAuthenticated)
.all(passportConf.isAuthorized)
.get(apiController.getTwitter)
.post(apiController.postTwitter);
app.route('/api/venmo')
.all(passportConf.isAuthenticated)
.all(passportConf.isAuthorized)
.get(apiController.getVenmo)
.post(apiController.postVenmo);
app.route('/api/linkedin')
.all(passportConf.isAuthenticated)
.all(passportConf.isAuthorized)
.get(apiController.getLinkedin);
app.route('/api/instagram')
.all(passportConf.isAuthenticated)
.all(passportConf.isAuthorized)
.get(apiController.getInstagram);
/** /**
* OAuth sign-in routes. * OAuth sign-in routes.