diff options
author | Dennis Eriksen <dennis.se@gmail.com> | 2013-05-25 11:17:42 +0200 |
---|---|---|
committer | Dennis Eriksen <dennis.se@gmail.com> | 2013-05-25 11:17:42 +0200 |
commit | e582c3b84c6090b08f33d599c354968fcd868d14 (patch) | |
tree | b6de1b7b1f708bf9126ccb709d5129e91a67c7d5 /config | |
parent | changed what gets collected (diff) | |
download | Divid-e582c3b84c6090b08f33d599c354968fcd868d14.tar.gz |
moved and renamed files to match the filesetup we want.
havebeen using a dev-setup till now.
Diffstat (limited to 'config')
-rw-r--r-- | config/express.js | 2 | ||||
-rw-r--r-- | config/routes.js | 73 |
2 files changed, 74 insertions, 1 deletions
diff --git a/config/express.js b/config/express.js index eb10b20..4c09b17 100644 --- a/config/express.js +++ b/config/express.js @@ -13,7 +13,7 @@ var express = require('express'); module.exports = function (app, config, passport) { //sets view engine and path - app.set('views', config.root + '/views'); + app.set('views', config.root + '/app/views'); app.set('view engine', 'ejs'); app.use(express.static(config.root + '/public')); diff --git a/config/routes.js b/config/routes.js new file mode 100644 index 0000000..8ba83a9 --- /dev/null +++ b/config/routes.js @@ -0,0 +1,73 @@ + +/** + * Dependencies + */ + +var users = require('../app/controllers/users') + , system = require('../app/controllers/system'); + + +/* + * ============================================================ + * Routes + * + */ + +module.exports = function(app, passport, auth) { + app.get('/', system.index); + + app.get('/faq', system.faq); + + app.get('/contact', system.contact); + + app.post('/login', passport.authenticate('local', { failureRedirect: '/' }), users.signin); + + app.get('/signup', users.signup); + + app.post('/signup', users.create); + + app.get('/auth/facebook', passport.authenticate('facebook', { failureRedirect: '/' }), users.signin); + app.get('/auth/facebook/callback', passport.authenticate('facebook', { failureRedirect: '/' }), users.authCallback); + + app.get('/auth/twitter', passport.authenticate('twitter', { failureRedirect: '/' }), users.signin); + app.get('/auth/twitter/callback', passport.authenticate('twitter', { failureRedirect: '/' }), users.authCallback); + + app.get('/invite/:randomToken', users.claimInvite); + + app.post('/invite/:randomToken', users.postClaimInvite); + + app.get('/logout', users.logout); + + app.get('/login/:hash', passport.authenticate('hash', { failureRedirect: '/'}), users.randomLogin); + + /** + * REQUIRES LOGIN + * ============================================================ + */ + + + app.get('/dashboard', auth.requiresLogin, system.dashboard); + + app.get('/registerEmail', auth.requiresLogin, users.registerEmail); + + app.post('/registerEmail', auth.requiresLogin, users.postRegisterEmail); + + app.get('/project', auth.requiresLogin, system.project); + + app.get('/project/new', auth.requiresLogin, system.newProject); + + app.post('/project/new', auth.requiresLogin, system.postNewProject); + + app.get('/project/:short', auth.requiresLogin, system.project); + + app.get('/project/:short/post', auth.requiresLogin, system.projectPost); + + app.post('/project/:short/post', auth.requiresLogin, system.postProjectPost); + + app.get('/project/:short/participants', auth.requiresLogin, system.projectParticipants); + + app.post('/project/:short/participants', auth.requiresLogin, users.postProjectParticipants); // goes to the usercontroller because participants are users + + app.get('/project/:short/delete/:post', auth.requiresLogin, system.deleteProjectPost); + +}; |