forked from ecomplus/storage-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
38 lines (33 loc) · 886 Bytes
/
main.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
'use strict'
/**
* @file E-Com Plus Storage API Node.js Express App
* @copyright E-Com Club. All rights reserved. Since 2016
* <br>E-COM CLUB SOFTWARES PARA E-COMMERCE LTDA / CNPJ: 24.356.660/0001-78
* @license GPL-3.0
* @author E-Com Club
*/
process.on('uncaughtException', (err) => {
// fatal error
// log to file before exit
let msg = '\n[' + new Date().toString() + ']\n'
if (err) {
if (err.hasOwnProperty('stack')) {
msg += err.stack
} else if (err.hasOwnProperty('message')) {
msg += err.message
} else {
msg += err.toString()
}
msg += '\n'
}
let fs = require('fs')
fs.appendFile('/var/log/nodejs/_stderr', msg, () => {
process.exit(1)
})
})
// web application
// recieve requests from Nginx by reverse proxy
require('./bin/web.js')
// local application
// executable server side only
require('./bin/local.js')