proteje rotas com JwtAuthGuard e documenta endpoints com Swagger
This commit is contained in:
14
src/main.ts
14
src/main.ts
@@ -1,11 +1,20 @@
|
||||
/* eslint-disable prettier/prettier */
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { AppModule } from './app.module';
|
||||
import { ValidationPipe } from '@nestjs/common';
|
||||
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
|
||||
|
||||
app.useGlobalPipes(
|
||||
new ValidationPipe({
|
||||
whitelist: true,
|
||||
forbidNonWhitelisted: true,
|
||||
transform: true,
|
||||
}),
|
||||
);
|
||||
|
||||
app.enableCors({
|
||||
origin: '*',
|
||||
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
|
||||
@@ -23,6 +32,7 @@ async function bootstrap() {
|
||||
const document = SwaggerModule.createDocument(app, config);
|
||||
SwaggerModule.setup('docs', app, document);
|
||||
|
||||
await app.listen(9009);
|
||||
|
||||
await app.listen(9001);
|
||||
}
|
||||
bootstrap();
|
||||
|
||||
Reference in New Issue
Block a user