Initial commit
CI / Сборка (push) Canceled after 0s
CI / Деплой на стейджинг (push) Canceled after 0s
CI / Проверка кода (push) Canceled after 0s
CI / Сборка (pull_request) Successful in 1m33s
Стенд master
CI / Деплой на стейджинг (pull_request) Successful in 8s
CI / Проверка кода (pull_request) Successful in 1m32s
CI / Сборка (push) Canceled after 0s
CI / Деплой на стейджинг (push) Canceled after 0s
CI / Проверка кода (push) Canceled after 0s
CI / Сборка (pull_request) Successful in 1m33s
Стенд master
CI / Деплой на стейджинг (pull_request) Successful in 8s
CI / Проверка кода (pull_request) Successful in 1m32s
This commit is contained in:
commit
1420aad1ae
92 files changed
+19114
No files matched your search
@@ -0,0 +1,62 @@
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
||||
|
||||
import { AppModule } from './app/app.module';
|
||||
import { getBaseLogger, LocalLoggerModule, Logger } from './logger';
|
||||
|
||||
async function start() {
|
||||
const PORT = process.env.PORT || 5000;
|
||||
|
||||
const app = await NestFactory.create(AppModule, {
|
||||
bufferLogs: true,
|
||||
});
|
||||
|
||||
// Подменяем логгер Nest на pino; накопленный в буфере вывод сбрасывается в него же
|
||||
LocalLoggerModule.setup(app);
|
||||
|
||||
const logger = new Logger('Bootstrap');
|
||||
|
||||
logger.log('Logging started', {
|
||||
level: getBaseLogger().level,
|
||||
pretty: process.env.NODE_ENV !== 'production' && process.env.LOG_PRETTY !== 'false',
|
||||
});
|
||||
|
||||
// настройка swaggera
|
||||
const config = new DocumentBuilder()
|
||||
.setTitle('GEO Helm Backend')
|
||||
.setDescription('Documentation for the GEO Helm Backend')
|
||||
.setVersion('1.0.0')
|
||||
.addBearerAuth(
|
||||
{
|
||||
type: 'http',
|
||||
scheme: 'bearer',
|
||||
bearerFormat: 'JWT',
|
||||
name: 'JWT',
|
||||
description: 'Enter JWT token',
|
||||
in: 'header',
|
||||
},
|
||||
'JWT-auth',
|
||||
)
|
||||
.build();
|
||||
app.enableShutdownHooks();
|
||||
app.setGlobalPrefix('api');
|
||||
const server = app.getHttpServer();
|
||||
server.setTimeout(20 * 60 * 1000); // 20-minute window for heavy calculations
|
||||
// подключаем swagger к приложению и указываем путь к документации
|
||||
const document = SwaggerModule.createDocument(app, config);
|
||||
SwaggerModule.setup('/api/docs', app, document);
|
||||
app.enableCors({
|
||||
origin:
|
||||
process.env.NODE_ENV === 'development'
|
||||
? ['http://localhost:5173']
|
||||
: ['https://app.igeo.pro'],
|
||||
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
|
||||
allowedHeaders: 'Content-Type, Authorization',
|
||||
credentials: true,
|
||||
});
|
||||
|
||||
await app.listen(PORT);
|
||||
|
||||
logger.log('Server started', { port: PORT });
|
||||
}
|
||||
start();
|
||||
Reference in new issue
Block a user