mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-24 21:12:38 -04:00
4cc888ce2f
Add endpoints to chat for deleting expired project chat data GitOrigin-RevId: e4eb7c7a79472bb116b2095a76c870e204590288
28 lines
542 B
JavaScript
28 lines
542 B
JavaScript
const { db, waitForDb } = require('../../../../app/js/mongodb')
|
|
const app = require('../../../../app')
|
|
|
|
let serverPromise = null
|
|
function startServer(resolve, reject) {
|
|
waitForDb()
|
|
.then(() => {
|
|
app.listen(3010, 'localhost', error => {
|
|
if (error) {
|
|
return reject(error)
|
|
}
|
|
resolve()
|
|
})
|
|
})
|
|
.catch(reject)
|
|
}
|
|
|
|
async function ensureRunning() {
|
|
if (!serverPromise) {
|
|
serverPromise = new Promise(startServer)
|
|
}
|
|
return serverPromise
|
|
}
|
|
|
|
module.exports = {
|
|
db,
|
|
ensureRunning,
|
|
}
|