23 lines
668 B
TypeScript
23 lines
668 B
TypeScript
import { NestFactory, Reflector } from '@nestjs/core';
|
|
import { AppModule } from './app.module';
|
|
import { ValidationPipe } from '@nestjs/common';
|
|
import { ClassSerializerInterceptor } from '@nestjs/common';
|
|
|
|
async function bootstrap() {
|
|
const app = await NestFactory.create(AppModule);
|
|
app.useGlobalInterceptors(new ClassSerializerInterceptor(app.get(Reflector)));
|
|
app.setGlobalPrefix('api', {
|
|
exclude: ['/'],
|
|
});
|
|
|
|
app.enableCors();
|
|
|
|
app.useGlobalPipes(
|
|
new ValidationPipe({
|
|
transform: true, // Transform is recomended configuration for avoind issues with arrays of files transformations
|
|
}),
|
|
);
|
|
await app.listen(3000);
|
|
}
|
|
bootstrap();
|