-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
52 lines (33 loc) · 1.17 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
43
44
45
46
47
48
49
50
51
52
/**
* Module dependencies.
*/
var express = require('express');
var fs = require('fs');
passport = require('passport');
var io = require('socket.io');
/**
* Main application entry file.
* Please note that the order of loading is important.
*/
// Load Configurations
var env = process.env.NODE_ENV = process.env.NODE_ENV || 'development';
var config = require('./config/config');
var auth = require('./config/middlewares/authorization');
var db = require('./config/sequelize');
var passport = require('./config/passport');
var app = express();
//Initialize Express
var server = require('http').createServer(app);
var io = require('socket.io').listen(server);
require('./config/express')(app, passport);
require('./config/routes').init(app, passport, auth);
//Start the app by listening on <port>
var port = process.env.PORT || config.port;
var server = app.listen(port);
console.log('Express app started on port ' + port);
require('./app/controllers/workers/worker');
//io.sockets.on('connection', worker);
require('./config/socket-io')(app, server);
//Initialize Routes
//expose app
exports = module.exports = app;