-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
executable file
·53 lines (39 loc) · 1.33 KB
/
Copy pathserver.js
File metadata and controls
executable file
·53 lines (39 loc) · 1.33 KB
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
53
console.log("");
console.log("//************************* MYVCARD-NODE App 1.0.0 **************************//");
console.log("Server Start Date : ", new Date());
//.env file read
require('dotenv').config({ debug: process.env.DEBUG });
//socket
//require('./lib/socketChat');
// Import Config
const config = require('./lib/config');
// Import mongodb cronjob
//require('./lib/mongodbJobScheduler');
// Import logger
var logger = require('./lib/logger').logger;
config.dbConfig(config.cfg, (error) => {
if (error) {
logger.error(error, 'Exiting the app.');
return;
}
// load external modules
const express = require('express');
var responseTime = require('response-time');
// init express app
const app = express();
app.use(responseTime());
// set the view engine to ejs
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
// set server home directory
app.locals.rootDir = __dirname;
// config express
config.expressConfig(app, config.cfg.environment);
console.log('env : ', config.cfg.environment);
// attach the routes to the app
require('./lib/route')(app);
// start server
app.listen(config.cfg.port, () => {
logger.info(`Express server listening on ${config.cfg.ip}:${config.cfg.port}, in ${config.cfg.TAG} mode`);
});
});