2023-01-04 15:07:58 +00:00
|
|
|
import { createServer } from '../../../../app/js/server.js'
|
|
|
|
import { promisify } from 'util'
|
2022-12-13 12:37:49 +00:00
|
|
|
|
|
|
|
export { db } from '../../../../app/js/mongodb.js'
|
2018-01-29 12:01:26 +00:00
|
|
|
|
2022-01-10 09:29:32 +00:00
|
|
|
let serverPromise = null
|
|
|
|
|
2022-12-13 12:37:49 +00:00
|
|
|
export async function ensureRunning() {
|
2022-01-10 09:29:32 +00:00
|
|
|
if (!serverPromise) {
|
2023-01-04 15:07:58 +00:00
|
|
|
const { app } = await createServer()
|
|
|
|
const startServer = promisify(app.listen.bind(app))
|
|
|
|
serverPromise = startServer(3010, 'localhost')
|
2022-01-10 09:29:32 +00:00
|
|
|
}
|
|
|
|
return serverPromise
|
|
|
|
}
|