24 lines
691 B
TypeScript
24 lines
691 B
TypeScript
import { NestFactory } from '@nestjs/core';
|
|
import { AppModule } from './app.module';
|
|
import { ValidationPipe } from '@nestjs/common';
|
|
|
|
async function bootstrap() {
|
|
const app = await NestFactory.create(AppModule);
|
|
|
|
app.useGlobalPipes(
|
|
new ValidationPipe({
|
|
whitelist: true, // elimina propiedades que no existan en el DTO
|
|
transform: true, // permite que @Type() funcione
|
|
transformOptions: { enableImplicitConversion: true }, // convierte strings → number/date
|
|
}),
|
|
);
|
|
|
|
|
|
app.enableCors();
|
|
await app.listen(process.env.APP_PORT ?? 3000);
|
|
console.log(
|
|
`Aplicación corriendo en: http://localhost:${process.env.APP_PORT ?? 3000}`,
|
|
);
|
|
}
|
|
bootstrap();
|