2026-05-07 19:11:14 +03:30
|
|
|
import 'reflect-metadata';
|
2026-05-12 16:17:39 +03:30
|
|
|
import { ValidationPipe } from '@nestjs/common';
|
2026-05-02 18:54:01 +03:30
|
|
|
import { NestFactory } from '@nestjs/core';
|
2026-05-12 14:42:36 +03:30
|
|
|
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
2026-05-02 18:54:01 +03:30
|
|
|
import { AppModule } from './app.module';
|
|
|
|
|
|
|
|
|
|
async function bootstrap() {
|
|
|
|
|
const app = await NestFactory.create(AppModule);
|
2026-05-12 16:17:39 +03:30
|
|
|
app.useGlobalPipes(
|
|
|
|
|
new ValidationPipe({
|
|
|
|
|
forbidNonWhitelisted: true,
|
|
|
|
|
transform: true,
|
|
|
|
|
whitelist: true,
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
|
2026-05-12 14:42:36 +03:30
|
|
|
const swaggerConfig = new DocumentBuilder()
|
|
|
|
|
.setTitle('Montime API')
|
|
|
|
|
.setDescription('Local services super app API')
|
|
|
|
|
.setVersion('1.0')
|
2026-05-12 15:49:46 +03:30
|
|
|
.addBearerAuth(
|
|
|
|
|
{
|
|
|
|
|
type: 'http',
|
|
|
|
|
scheme: 'bearer',
|
|
|
|
|
bearerFormat: 'JWT',
|
|
|
|
|
},
|
|
|
|
|
'bearer',
|
|
|
|
|
)
|
|
|
|
|
.addSecurityRequirements('bearer')
|
2026-05-12 14:42:36 +03:30
|
|
|
.build();
|
|
|
|
|
|
|
|
|
|
const swaggerDocument = SwaggerModule.createDocument(app, swaggerConfig);
|
|
|
|
|
SwaggerModule.setup('docs', app, swaggerDocument, {
|
|
|
|
|
swaggerOptions: {
|
|
|
|
|
persistAuthorization: true,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
2026-05-02 18:54:01 +03:30
|
|
|
await app.listen(process.env.PORT ?? 3000);
|
|
|
|
|
}
|
|
|
|
|
bootstrap();
|