27 lines
877 B
TypeScript
27 lines
877 B
TypeScript
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();
|