Initial commit
This commit is contained in:
26
apps/api/src/index.ts
Normal file
26
apps/api/src/index.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { buildApp } from './app';
|
||||
import { env } from './lib/env';
|
||||
import { logger } from './lib/logger';
|
||||
|
||||
async function start(): Promise<void> {
|
||||
const app = await buildApp();
|
||||
|
||||
try {
|
||||
await app.listen({ port: env.PORT, host: env.HOST });
|
||||
logger.info({ port: env.PORT }, 'DwellOps API is running');
|
||||
} catch (err) {
|
||||
logger.error({ err }, 'Failed to start server');
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle graceful shutdown
|
||||
process.on('SIGTERM', () => {
|
||||
logger.info('SIGTERM received — shutting down gracefully');
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
start().catch((err) => {
|
||||
logger.error({ err }, 'Startup error');
|
||||
process.exit(1);
|
||||
});
|
||||
Reference in New Issue
Block a user