diff options
author | Dennis Eriksen <dennis.se@gmail.com> | 2013-04-29 03:39:15 +0200 |
---|---|---|
committer | Dennis Eriksen <dennis.se@gmail.com> | 2013-04-29 03:39:15 +0200 |
commit | fc50b5b7f18d02ffa8056dc1edbd3bd43e973493 (patch) | |
tree | e4646512634a42790bbddfec8b3d035bb2052cec /app.js | |
parent | added twitter authentication (diff) | |
download | Divid-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.js | 22 |
1 files changed, 18 insertions, 4 deletions
@@ -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); /** |