app.js 695 B

123456789101112131415161718192021222324
  1. import Settings from '@overleaf/settings'
  2. import logger from '@overleaf/logger'
  3. import OError from '@overleaf/o-error'
  4. import { mongoClient } from './app/js/mongodb.js'
  5. import { app } from './app/js/server.js'
  6. const host = Settings.internal.history.host
  7. const port = Settings.internal.history.port
  8. mongoClient
  9. .connect()
  10. .then(() => {
  11. app.listen(port, host, error => {
  12. if (error != null) {
  13. logger.error(OError.tag(error, 'could not start history server'))
  14. } else {
  15. logger.debug(`history starting up, listening on ${host}:${port}`)
  16. }
  17. })
  18. })
  19. .catch(err => {
  20. logger.fatal({ err }, 'Cannot connect to mongo. Exiting.')
  21. process.exit(1)
  22. })