mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 00:52:50 +00:00
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import "reflect-metadata";
|
|
import { NestFactory } from "@nestjs/core";
|
|
import { DocumentBuilder, SwaggerModule } from "@nestjs/swagger";
|
|
import {
|
|
HttpExceptionFilter,
|
|
ResponseTransformInterceptor,
|
|
createValidationPipe,
|
|
} from "@edr/api-common";
|
|
|
|
import { AppModule } from "./app.module";
|
|
|
|
async function bootstrap() {
|
|
const app = await NestFactory.create(AppModule, { cors: true });
|
|
|
|
app.setGlobalPrefix("api");
|
|
app.useGlobalPipes(createValidationPipe());
|
|
app.useGlobalFilters(new HttpExceptionFilter());
|
|
app.useGlobalInterceptors(new ResponseTransformInterceptor());
|
|
|
|
const config = new DocumentBuilder()
|
|
.setTitle("EDR Passenger API")
|
|
.setDescription("API for the EDR Passenger Management application")
|
|
.setVersion("0.1.0")
|
|
.addBearerAuth()
|
|
.build();
|
|
const document = SwaggerModule.createDocument(app, config);
|
|
SwaggerModule.setup("api/docs", app, document);
|
|
|
|
const port = parseInt(process.env.PORT ?? "3002", 10);
|
|
await app.listen(port);
|
|
// eslint-disable-next-line no-console
|
|
console.log(`[passenger-api] listening on http://localhost:${port}`);
|
|
}
|
|
|
|
bootstrap();
|