2022-12-21 10:39:13 -05:00
|
|
|
import { server } from '../../../../app/js/server.js'
|
2022-12-13 07:37:49 -05:00
|
|
|
|
|
|
|
export { db } from '../../../../app/js/mongodb.js'
|
2018-01-29 07:01:26 -05:00
|
|
|
|
2022-01-10 04:29:32 -05:00
|
|
|
let serverPromise = null
|
2022-12-21 10:39:13 -05:00
|
|
|
function startServer(resolve, reject) {
|
|
|
|
server.listen(3010, 'localhost', error => {
|
|
|
|
if (error) {
|
|
|
|
return reject(error)
|
|
|
|
}
|
|
|
|
resolve()
|
|
|
|
})
|
|
|
|
}
|
2022-01-10 04:29:32 -05:00
|
|
|
|
2022-12-13 07:37:49 -05:00
|
|
|
export async function ensureRunning() {
|
2022-01-10 04:29:32 -05:00
|
|
|
if (!serverPromise) {
|
2022-12-21 10:39:13 -05:00
|
|
|
serverPromise = new Promise(startServer)
|
2022-01-10 04:29:32 -05:00
|
|
|
}
|
|
|
|
return serverPromise
|
|
|
|
}
|