2023-01-04 10:07:58 -05:00
|
|
|
import { createServer } from '../../../../app/js/server.js'
|
|
|
|
import { promisify } from 'util'
|
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-13 07:37:49 -05:00
|
|
|
export async function ensureRunning() {
|
2022-01-10 04:29:32 -05:00
|
|
|
if (!serverPromise) {
|
2023-01-04 10:07:58 -05:00
|
|
|
const { app } = await createServer()
|
|
|
|
const startServer = promisify(app.listen.bind(app))
|
2024-04-25 08:56:00 -04:00
|
|
|
serverPromise = startServer(3010, '127.0.0.1')
|
2022-01-10 04:29:32 -05:00
|
|
|
}
|
|
|
|
return serverPromise
|
|
|
|
}
|