import { buildServer } from './app.js'; import { loadConfig } from './config.js'; const config = await loadConfig(); const { port, host } = config.server; const app = await buildServer({ config }); try { await app.listen({ port, host }); console.log(`court.lab server listening on http://${host}:${port}`); const shutdown = async () => { try { await app.close(); } finally { process.exit(0); } }; process.once('SIGTERM', shutdown); process.once('SIGINT', shutdown); } catch (error) { app.log.error(error); await app.close().catch(() => {}); process.exitCode = 1; }