-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
42 lines (36 loc) · 1.22 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
'use strict';
/**
* Module dependencies.
*/
var express = require('express');
var http = require('http');
var path = require('path');
var mongoose = require('mongoose');
var passport = require('./modules/passport');
var cookieParser = require('cookie-parser');
var session = require('express-session');
var bodyParser = require('body-parser');
var modules = require('./modules');
var config = require('./config');
var app = express();
mongoose.set('debug', true);//config.database.auth
mongoose.connect(config.database.url, {} , function (err) {
// all environments
app.set('port', process.env.PORT || 3000);
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
app.use(require('less-middleware')(path.join(__dirname, 'public'), { force: true }));
app.use(express.static(path.join(__dirname, 'public')));
app.use(cookieParser());
app.use(bodyParser());
app.use(session({
secret: 'itech-connect',
cookie: { secure: true }
}));
passport.initialize(app);
app.use(passport.auth);
modules.init(app);
http.createServer(app).listen(app.get('port'), function () {
console.log('Express server listening on port ' + app.get('port'));
});
});