overleaf/services/chat/app.js
Lucie Germain 7ed9b04c3c Merge pull request #10983 from overleaf/revert-10901-lg-openapi-chat
Revert "Migrate chat service to OpenAPI"

GitOrigin-RevId: 39bdfd98bc55f8d9d56fb18bb288749aa13f25e0
2022-12-22 09:04:56 +00:00

22 lines
655 B
JavaScript

import logger from '@overleaf/logger'
import settings from '@overleaf/settings'
import { mongoClient } from './app/js/mongodb.js'
import { server } from './app/js/server.js'
const port = settings.internal.chat.port
const host = settings.internal.chat.host
mongoClient
.connect()
.then(() => {
server.listen(port, host, function (err) {
if (err) {
logger.fatal({ err }, `Cannot bind to ${host}:${port}. Exiting.`)
process.exit(1)
}
logger.debug(`Chat starting up, listening on ${host}:${port}`)
})
})
.catch(err => {
logger.fatal({ err }, 'Cannot connect to mongo. Exiting.')
process.exit(1)
})