mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 14:43:46 +01:00
[misc] migrate the app to the native mongo driver
acceptance tests to follow in a separate commit.
This commit is contained in:
@@ -44,6 +44,7 @@ Metrics.memory.monitor(logger)
|
||||
|
||||
const childProcess = require('child_process')
|
||||
|
||||
const mongodb = require('./app/js/mongodb')
|
||||
const HttpController = require('./app/js/HttpController')
|
||||
const express = require('express')
|
||||
const bodyParser = require('body-parser')
|
||||
@@ -128,18 +129,26 @@ const host =
|
||||
|
||||
if (!module.parent) {
|
||||
// Called directly
|
||||
app.listen(port, host, function (error) {
|
||||
if (error != null) {
|
||||
return logger.error(
|
||||
{ err: error },
|
||||
'could not start track-changes server'
|
||||
)
|
||||
} else {
|
||||
return logger.info(
|
||||
`trackchanges starting up, listening on ${host}:${port}`
|
||||
)
|
||||
}
|
||||
})
|
||||
mongodb
|
||||
.waitForDb()
|
||||
.then(() => {
|
||||
app.listen(port, host, function (error) {
|
||||
if (error != null) {
|
||||
return logger.error(
|
||||
{ err: error },
|
||||
'could not start track-changes server'
|
||||
)
|
||||
} else {
|
||||
return logger.info(
|
||||
`trackchanges starting up, listening on ${host}:${port}`
|
||||
)
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch((err) => {
|
||||
logger.fatal({ err }, 'Cannot connect to mongo. Exiting.')
|
||||
process.exit(1)
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = app
|
||||
|
||||
Reference in New Issue
Block a user