32 lines
841 B
TypeScript
32 lines
841 B
TypeScript
import 'reflect-metadata';
|
|
import { NestFactory } from '@nestjs/core';
|
|
import { ValidationPipe, Logger } from '@nestjs/common';
|
|
import { AppModule } from './app.module';
|
|
|
|
const logger = new Logger('Bootstrap');
|
|
|
|
async function bootstrap(): Promise<void> {
|
|
const app = await NestFactory.create(AppModule);
|
|
|
|
app.setGlobalPrefix('api/client-intel');
|
|
|
|
app.useGlobalPipes(
|
|
new ValidationPipe({
|
|
whitelist: true,
|
|
forbidNonWhitelisted: true,
|
|
transform: true,
|
|
}),
|
|
);
|
|
|
|
const port = parseInt(process.env['PORT'] ?? '3027', 10);
|
|
await app.listen(port, '127.0.0.1');
|
|
logger.log(`Client Intel API listening on port ${port}`);
|
|
}
|
|
|
|
bootstrap().catch((err: unknown) => {
|
|
new Logger('Bootstrap').error(
|
|
'Failed to start application',
|
|
err instanceof Error ? err.stack : String(err),
|
|
);
|
|
process.exit(1);
|
|
});
|