Server/src/main.ts

21 lines
529 B
TypeScript
Raw Normal View History

import { NestFactory, Reflector } from "@nestjs/core";
2024-11-23 00:37:22 +00:00
import { AppModule } from "./app.module";
import { ClassSerializerInterceptor, ValidationPipe } from "@nestjs/common";
2024-11-23 00:37:22 +00:00
async function bootstrap() {
const app = await NestFactory.create(AppModule);
2024-11-24 01:34:20 +00:00
app.enableCors({
origin: "*",
2024-11-24 01:34:20 +00:00
});
app.useGlobalPipes(new ValidationPipe());
app.useGlobalInterceptors(new ClassSerializerInterceptor(app.get(Reflector), {
excludeExtraneousValues: true,
}));
await app.listen(process.env.PORT ?? 3000, "0.0.0.0");
2024-11-23 00:37:22 +00:00
}
bootstrap();