overleaf/services/contacts/app.js
Alf Eaton c14467b87a Migrate contacts service to ES modules (#10904)
GitOrigin-RevId: c5abb64729530baecbee0eb589eaed39faa2ac56
2022-12-19 09:03:55 +00:00

21 lines
568 B
JavaScript

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