-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.ts
31 lines (28 loc) · 998 Bytes
/
main.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import cookieParser from 'cookie-parser';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
import { AllExceptionsFilter } from './custom-exception/custom-exception.filter';
async function bootstrap() {
const app = await NestFactory.create(AppModule, {
cors: true
});
app.use(cookieParser());
// Swagger docs with authentication
const config = new DocumentBuilder()
.setTitle('GooglexYug')
.setDescription('The googlexyug API description')
.setVersion('1.0')
.addTag('app')
.addBearerAuth({ type: 'http', bearerFormat: "JWT", scheme: "bearer", in: "header" }, "access-token")
.build();
const document = SwaggerModule.createDocument(app, config);
SwaggerModule.setup('api', app, document, {
swaggerOptions: {
persistAuthorization: true,
},
});
app.useGlobalFilters(new AllExceptionsFilter());
await app.listen(8080);
}
bootstrap();