aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDennis Eriksen <dennis.se@gmail.com>2013-04-30 13:31:00 +0200
committerDennis Eriksen <dennis.se@gmail.com>2013-04-30 13:31:00 +0200
commit7ef5bc29e6032ae9f7318ae5790e45057f7e5b4f (patch)
tree3aec3ef13a0c5f92322c2f5999f44f4e4c31d1b3
parentMerge branch 'master' of github.com:dennisse/Divid (diff)
downloadDivid-7ef5bc29e6032ae9f7318ae5790e45057f7e5b4f.tar.gz
renamed router to routes as it now contains more static routes, than actually working as a router
-rw-r--r--app.js2
-rw-r--r--routes.js61
2 files changed, 62 insertions, 1 deletions
diff --git a/app.js b/app.js
index f9aa1b9..618ef8d 100644
--- a/app.js
+++ b/app.js
@@ -44,7 +44,7 @@ require('./config/express')(app, config, passport);
/**
* Routes
*/
-require('./router')(app, passport, auth);
+require('./routes')(app, passport, auth);
/**
diff --git a/routes.js b/routes.js
new file mode 100644
index 0000000..ae94779
--- /dev/null
+++ b/routes.js
@@ -0,0 +1,61 @@
+
+/**
+ * Dependencies
+ */
+
+var users = require('./controllers/users')
+ , system = require('./controllers/system');
+
+
+/*
+ * ============================================================
+ * Routes
+ *
+ */
+
+module.exports = function(app, passport, auth) {
+ app.get('/', system.index);
+
+ app.get('/test', system.test);
+
+ app.get('/home', system.home);
+
+ app.get('/faq', system.faq);
+
+ app.get('/login', users.login);
+
+ app.get('/signup', users.signup);
+
+ app.post('/signup', users.create);
+
+
+ app.post('/test', users.signin);
+
+ app.get('/auth/facebook', passport.authenticate('facebook', { failureRedirect: '/test' }), users.signin);
+
+ app.get('/auth/facebook/callback', passport.authenticate('facebook', { failureRedirect: '/test' }), function(req, res) {
+ console.log('/auth/facebook/callback --- ' + req.user.username);
+ res.redirect('/dashboard');
+ });
+
+ app.get('/auth/twitter', passport.authenticate('twitter', { failureRedirect: '/test' }), users.signin);
+ app.get('/auth/twitter/callback', passport.authenticate('twitter', { failureRedirect: '/test' }), users.authCallback);
+
+ app.get('/logout', users.logout);
+
+
+ /**
+ * REQUIRES LOGIN
+ * ============================================================
+ */
+
+
+ app.get('/dashboard', auth.requiresLogin, system.dashboard);
+
+
+ app.get('/project', auth.requiresLogin, system.project);
+
+ app.get('/project/new', auth.requiresLogin, system.newProject);
+
+ app.post('/project/new', auth.requiresLogin, system.postNewProject)
+};