-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
executable file
·42 lines (35 loc) · 1.13 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
'use strict'
require('dotenv').config()
const { KthAppinsights } = require('@kth/appinsights')
KthAppinsights.init({ name: 'kursinfo-admin-web' })
const log = require('@kth/log')
const config = require('./server/configuration').server
const server = require('./server/server')
const packageFile = require('./package.json')
// catches uncaught exceptions
process.on('uncaughtException', (err, origin) => {
log.error('APPLICATION EXIT - uncaught exception in ', packageFile.name)
log.error(`Uncaught Exception, origin (${origin})`, { err })
process.exit(1)
})
// catches unhandled promise rejections
process.on('unhandledRejection', reason => {
// This line below provokes an uncaughtException and will be caught few lines
// above
log.error(`unhandledRejection ${packageFile.name}`, reason)
// throw reason
})
/* ****************************
* ******* SERVER START *******
* ****************************
*/
module.exports = server.start({
useSsl: config.useSsl,
pfx: config.ssl.pfx,
passphrase: config.ssl.passphrase,
key: config.ssl.key,
ca: config.ssl.ca,
cert: config.ssl.cert,
port: config.port,
logger: log,
})