-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
37 lines (32 loc) · 924 Bytes
/
index.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
// /index.js
'use strict';
var server = require('./config/initializers/server');
var nconf = require('nconf');
var async = require('async');
var logger = require('winston');
// Load Environment variables from .env file
require('dotenv').load();
// Set up configs
nconf.use('memory');
// First load command line arguments
nconf.argv();
// Load environment variables
nconf.env();
// Load config file for the environment
require('./config/environments/' + nconf.get('NODE_ENV'));
logger.info('[APP] Starting server initialization');
// Initialize Modules
async.waterfall([
function initializeDBConnection(callback) {
require('./config/initializers/database')(callback);
},
function startServer(pool, callback) {
server(pool, callback);
}], function(err) {
if (err) {
logger.error('[APP] initialization failed', err);
} else {
logger.info('[APP] initialized SUCCESSFULLY');
}
}
);