spb/cancerindex
Public
TypeScript 97.2%
SQL 1.5%
CSS 0.6%
JavaScript 0.5%
1import { loadEnv, API_HOST, API_PORT } from './lib/env.js';23loadEnv();45const { buildApp } = await import('./app.js');6const { closeDb } = await import('@cancerindex/database');78const app = await buildApp();910const shutdown = async (signal: string) => {11 app.log.info({ signal }, 'shutting down');12 try {13 await app.close();14 await closeDb();15 } finally {16 process.exit(0);17 }18};19process.on('SIGTERM', () => void shutdown('SIGTERM'));20process.on('SIGINT', () => void shutdown('SIGINT'));2122try {23 await app.listen({ host: API_HOST(), port: API_PORT() });24 app.log.info({ docs: `http://${API_HOST()}:${API_PORT()}/v1/docs` }, 'CancerIndex API ready');25} catch (err) {26 app.log.error({ err }, 'failed to start');27 process.exit(1);28}29