aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/app.js
diff options
context:
space:
mode:
authorDennis Eriksen <dennis.se@gmail.com>2013-04-29 03:39:15 +0200
committerDennis Eriksen <dennis.se@gmail.com>2013-04-29 03:39:15 +0200
commitfc50b5b7f18d02ffa8056dc1edbd3bd43e973493 (patch)
treee4646512634a42790bbddfec8b3d035bb2052cec /app.js
parentadded twitter authentication (diff)
downloadDivid-fc50b5b7f18d02ffa8056dc1edbd3bd43e973493.tar.gz
been cleaning a bit, moving stuff to where it belongs. signup and
signin works.
Diffstat (limited to 'app.js')
-rw-r--r--app.js22
1 files changed, 18 insertions, 4 deletions
diff --git a/app.js b/app.js
index 86b2fb9..5bc039d 100644
--- a/app.js
+++ b/app.js
@@ -4,7 +4,7 @@
*/
var express = require('express')
- , path = require('path')
+ , fs = require('fs')
, passport = require('passport');
@@ -13,10 +13,24 @@ var app = express(); // initiates express
/**
* App configuration
*/
-var port = process.env.PORT || 3000
+var port = process.env.PORT || 8000
, env = process.env.NODE_ENV || 'development'
- , config = require('./config/config')[env];
+ , config = require('./config/config')[env]
+ , auth = require('./config/middlewares/authorization')
+ , mongoose = require('mongoose');
+// Bootstrap db connection
+mongoose.connect(config.db);
+
+
+// Bootstrap models
+var models_path = __dirname + '/models';
+fs.readdirSync(models_path).forEach( function(file) {
+ require(models_path + '/' + file);
+});
+
+// Bootstrap passport config
+require('./config/passport')(passport, config);
/**
* Express
@@ -29,7 +43,7 @@ require('./config/express')(app, config, passport);
/**
* Routes
*/
-require('./router')(app, config);
+require('./router')(app, passport, auth);
/**