/
coffe
/
api
Обзор
Документация
Войти
/
coffe
/
api
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
main
src/main.ts
35 строк
1 KB
vwency
init
08 май 2026, 01:38
08 май 2026, 01:38
47ccfb3
Код
Авторство
О чём код?
import { NestFactory } from '@nestjs/core' import { AppModule } from './app.module' import { SwaggerModule } from '@nestjs/swagger' import * as cliColor from 'cli-color' import { SwaggerConfig } from './utils/swagger' import { corsOptions } from './utils/cors' import { onBootstrapComplete, onBootstrapError } from './utils/bootstrap/setup' import { SwaggerTheme, SwaggerThemeNameEnum } from 'swagger-themes' import { ZodValidationPipe } from './common/pipes' import { StatsInterceptor } from './common/interceptors/stats.interceptor' import { PrismaService } from './prisma/prisma.service' async function bootstrap() { console.log(cliColor.green('✅ NestJS application is starting...')) console.log() const app = await NestFactory.create(AppModule) const document = SwaggerModule.createDocument(app, SwaggerConfig) const theme = new SwaggerTheme() const options = { explorer: true, customCss: theme.getBuffer(SwaggerThemeNameEnum.DARK), } SwaggerModule.setup('api', app, document, options) app.enableCors(corsOptions) app.useGlobalPipes(new ZodValidationPipe()) app.useGlobalInterceptors(new StatsInterceptor(app.get(PrismaService))) await app.listen(3000) } bootstrap().then(onBootstrapComplete).catch(onBootstrapError)