mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-14 20:40:17 -05:00
795ed56034
GitOrigin-RevId: 62f875bb121a599fab830a3244959596796cd6e1
27 lines
532 B
JavaScript
27 lines
532 B
JavaScript
const { 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 = {
|
|
ensureRunning,
|
|
}
|