Co-authored-by: Jason Woltje <jason@diversecanvas.com> Co-committed-by: Jason Woltje <jason@diversecanvas.com>
25 lines
884 B
TypeScript
25 lines
884 B
TypeScript
import './tracing.js';
|
|
import 'reflect-metadata';
|
|
import { NestFactory } from '@nestjs/core';
|
|
import { Logger } from '@nestjs/common';
|
|
import { FastifyAdapter, type NestFastifyApplication } from '@nestjs/platform-fastify';
|
|
import { AppModule } from './app.module.js';
|
|
import { mountAuthHandler } from './auth/auth.controller.js';
|
|
|
|
async function bootstrap(): Promise<void> {
|
|
const logger = new Logger('Bootstrap');
|
|
const app = await NestFactory.create<NestFastifyApplication>(AppModule, new FastifyAdapter());
|
|
|
|
mountAuthHandler(app);
|
|
|
|
const port = process.env['GATEWAY_PORT'] ?? 4000;
|
|
await app.listen(port as number, '0.0.0.0');
|
|
logger.log(`Gateway listening on port ${port}`);
|
|
}
|
|
|
|
bootstrap().catch((err: unknown) => {
|
|
const logger = new Logger('Bootstrap');
|
|
logger.error('Fatal startup error', err instanceof Error ? err.stack : String(err));
|
|
process.exit(1);
|
|
});
|