summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/index.js14
-rw-r--r--server/lib/auth.js2
-rw-r--r--server/lib/views.js12
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
+ })
+}