2022-12-21 07:18:12 -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) {
|
2022-12-21 07:18:12 -05:00
|
|
|
const { app } = await createServer()
|
|
|
|
const startServer = promisify(app.listen.bind(app))
|
|
|
|
serverPromise = startServer(3010, 'localhost')
|
2022-01-10 04:29:32 -05:00
|
|
|
}
|
|
|
|
return serverPromise
|
|
|
|
}
|