-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
28 lines (24 loc) · 848 Bytes
/
index.ts
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
import createApp from './app.js'
import { isDevEnv } from './constants.js'
import { checkDbConnection } from './models/connection.js'
import appLogger from './appLogger.js'
import PresenceSystem from './Socket/PresenceSystem.js'
const port: number = process.env.PORT != null && process.env.PORT !== '' ? Number(process.env.PORT) : 3000
checkDbConnection(
() => {
appLogger.info('Database connection check successfull')
},
(err) => {
appLogger.error(`Database connection check failed: ${JSON.stringify(err)}`)
process.exit(1)
}
)
const presenceSystem = new PresenceSystem()
const server = createApp(presenceSystem)
server.listen(port, () => {
if (isDevEnv) {
appLogger.info(`DialogueV2 Dev Backend Server: http://localhost:${port}/`)
} else {
appLogger.info('DialogueV2 Application successfully started!')
}
})