mirror of
https://github.com/p-stream/backend.git
synced 2026-03-16 15:56:43 +00:00
32 lines
776 B
TypeScript
32 lines
776 B
TypeScript
import { setupFastify, startFastify } from '@/modules/fastify';
|
|
import { setupJobs } from '@/modules/jobs';
|
|
import { setupMetrics } from '@/modules/metrics';
|
|
import { setupMikroORM } from '@/modules/mikro';
|
|
import { scopedLogger } from '@/services/logger';
|
|
|
|
const log = scopedLogger('mw-backend');
|
|
|
|
async function bootstrap(): Promise<void> {
|
|
log.info(`App booting...`, {
|
|
evt: 'setup',
|
|
});
|
|
|
|
const app = await setupFastify();
|
|
await setupMikroORM();
|
|
await setupMetrics(app);
|
|
await setupJobs();
|
|
|
|
await startFastify(app);
|
|
|
|
log.info(`App setup, ready to accept connections`, {
|
|
evt: 'success',
|
|
});
|
|
log.info(`--------------------------------------`);
|
|
}
|
|
|
|
bootstrap().catch((err) => {
|
|
log.error(err, {
|
|
evt: 'setup-error',
|
|
});
|
|
process.exit(1);
|
|
});
|