-
Notifications
You must be signed in to change notification settings - Fork 20
/
server.js
39 lines (35 loc) · 900 Bytes
/
server.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
var app = require('./app/app')
, winston = require('winston')
, logger;
// Logger
exports.logger = logger = new (winston.Logger)({
levels: {
debug : 0
, http : 1
},
colors : {
debug : 'red'
, http : 'blue'
},
transports: [
new winston.transports.Console({
level : 'debug'
, colorize : true
, timestamp : true
})
, new (winston.transports.File)({
filename : "./log/" + (process.env.NODE_ENV || 'development') + ".log"
, level : 'http'
})
]
});
if (process.env.NODE_ENV == 'production' || process.env.NODE_ENV == 'test'){
logger.remove(winston.transports.Console);
};
// run HTTP Server
exports.app = app.run({
port: parseInt(process.argv[2] || 3000, 10)
, home: process.cwd() + '/app'
, logger: logger
});
// configure socket.io, background jobs, and other concerns here...