aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/config/routes.js
blob: 8ba83a9314b3a6b0c78b573f31798438acfb04e4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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);

};