summaryrefslogtreecommitdiff
path: root/server/index.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-06-05 15:19:33 -0400
committerJules Laplace <jules@okfoc.us>2014-06-05 15:19:33 -0400
commit1c8ecab7cc040196cf585d618b5eb9289a2efbc6 (patch)
tree9363ffcaf171327f8a7fa53206bf113d1b43a7b5 /server/index.js
parent62fdac2d01ad9d0c5a95cc6da5a5397cdd6f767b (diff)
moving things around
Diffstat (limited to 'server/index.js')
-rw-r--r--server/index.js14
1 files changed, 10 insertions, 4 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'));