overleaf/services/history-v1/api/controllers/health_checks.js
Alf Eaton ee85d948e2 Avoid duplicating a math-closing dollar sign (#11227)
GitOrigin-RevId: ef2ef77e26df59d1af3df6dc664e284d3c70102d
2023-01-16 08:41:42 +00:00

23 lines
516 B
JavaScript

const logger = require('@overleaf/logger')
const expressify = require('./expressify')
const { mongodb } = require('../../storage')
async function status(req, res) {
try {
await mongodb.db.command({ ping: 1 })
} catch (err) {
logger.warn({ err }, 'Lost connection with MongoDB')
res.status(500).send('Lost connection with MongoDB')
return
}
res.send('history-v1 is up')
}
function healthCheck(req, res) {
res.send('OK')
}
module.exports = {
status: expressify(status),
healthCheck,
}