2025-02-28 11:27:18 +03:00

27 lines
877 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.setGlobalPrefix('api'); // Все маршруты будут начинаться с `/api`
app.enableCors(); // Разрешаем CORS
// Настройка Swagger
const config = new DocumentBuilder()
.setTitle('Cool TODO Manager API')
.setDescription('NestJS + PostgreSQL + JWT + Docker')
.setVersion('2.0')
.addBearerAuth()
.build();
const document = SwaggerModule.createDocument(app, config);
SwaggerModule.setup('api/docs', app, document);
// Теперь Swagger доступен по /api/docs
await app.listen(3000);
console.log('🚀 Server running on http://localhost:3000/api');
}
bootstrap();