diff options
| author | Jules Laplace <jules@okfoc.us> | 2014-06-05 15:19:33 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2014-06-05 15:19:33 -0400 |
| commit | 1c8ecab7cc040196cf585d618b5eb9289a2efbc6 (patch) | |
| tree | 9363ffcaf171327f8a7fa53206bf113d1b43a7b5 /server | |
| parent | 62fdac2d01ad9d0c5a95cc6da5a5397cdd6f767b (diff) | |
moving things around
Diffstat (limited to 'server')
| -rw-r--r-- | server/index.js | 14 | ||||
| -rw-r--r-- | server/lib/auth.js | 2 | ||||
| -rw-r--r-- | server/lib/views.js | 12 |
3 files changed, 22 insertions, 6 deletions
diff --git a/server/index.js b/server/index.js index 1f22d71..0dfb640 100644 --- a/server/index.js +++ b/server/index.js @@ -4,7 +4,12 @@ ejs.open = '[['; ejs.close = ']]'; var config = require('../config.json'), - http = require('http'), + api = require('./lib/api'), + auth = require('./lib/auth'), + middleware = require('./lib/middleware'), + views = require('./lib/views'); + +var http = require('http'), express = require('express'), MongoStore = require('connect-mongo')(express), TwitterStrategy = require('passport-twitter').Strategy, @@ -53,12 +58,13 @@ passport.use(new TwitterStrategy({ consumerKey: process.env.VVALLS_TWITTER_KEY || '0L5blfBIapqhpons8bCXdIoGM', consumerSecret: process.env.VVALLS_TWITTER_SECRET || '5EKW7m7inoODqYSKbp7cadBKFp1FghBl4MBDoXNcUjKtodZfuP', callbackURL: 'http://' + config.host + '/auth/twitter/callback' -}, api.insertUser)); +}, auth.insertUser)); // Essential middleware // app.all('*', middleware.enableCORS); // Initialize views +app.get('/', views.front); app.get('/login', views.login); app.get('/logout', auth.logout); app.get('/auth/twitter', auth.login('twitter')); @@ -66,7 +72,7 @@ app.get('/auth/twitter/callback', auth.loggedIn('twitter')); - +/* io.set('authorization', passportSocketIo.authorize({ cookieParser: express.cookieParser, passport: passport, @@ -91,7 +97,7 @@ function onAuthorizeFail(data, message, error, accept){ // We use this callback to log all of our failed connections. accept(null, false); } - +*/ http.createServer(app).listen(app.get('port'), function () { console.log('Express server listening on port ' + app.get('port')); diff --git a/server/lib/auth.js b/server/lib/auth.js index 93fe223..04ab346 100644 --- a/server/lib/auth.js +++ b/server/lib/auth.js @@ -5,8 +5,6 @@ var passport = require('passport'), config = require('../../config.json'), User = require('./schemas/User'); -var entities = new Entities(); - var auth = { login: function (method) { diff --git a/server/lib/views.js b/server/lib/views.js index 7f3d1a0..ac72def 100644 --- a/server/lib/views.js +++ b/server/lib/views.js @@ -9,3 +9,15 @@ exports.login = function (req, res) { config: config }); }; + +exports.index = function (req, res) { + res.render('index', { + config: config + }) +} + +exports.profile = function (req, res) { + res.render('profile', { + config: config + }) +} |
