redis 잔여 설정도 제거
This commit is contained in:
@@ -14,28 +14,23 @@ import { LoggingInterceptor } from './common/interceptors/logging.interceptor';
|
||||
import { TransformInterceptor } from './common/interceptors/transform.interceptor';
|
||||
import { types } from 'pg';
|
||||
|
||||
// ========== 전역 에러 핸들러 (NestJS 도달 전 에러 캐치) ==========
|
||||
// ========== 전역 에러 핸들러 ==========
|
||||
process.on('uncaughtException', (error) => {
|
||||
console.error('╔══════════════════════════════════════════════════════════════╗');
|
||||
console.error('║ UNCAUGHT EXCEPTION ║');
|
||||
console.error('╚══════════════════════════════════════════════════════════════╝');
|
||||
console.error('╔═══════════ UNCAUGHT EXCEPTION ═══════════╗');
|
||||
console.error(`Timestamp: ${new Date().toISOString()}`);
|
||||
console.error(`Error: ${error.message}`);
|
||||
console.error(`Stack: ${error.stack}`);
|
||||
process.stdout.write(`[FATAL] Uncaught Exception: ${error.message}\n`);
|
||||
process.stdout.write(`[FATAL] Stack: ${error.stack}\n`);
|
||||
console.error('╚══════════════════════════════════════════╝');
|
||||
});
|
||||
|
||||
process.on('unhandledRejection', (reason, promise) => {
|
||||
console.error('╔══════════════════════════════════════════════════════════════╗');
|
||||
console.error('║ UNHANDLED REJECTION ║');
|
||||
console.error('╚══════════════════════════════════════════════════════════════╝');
|
||||
process.on('unhandledRejection', (reason) => {
|
||||
console.error('╔═══════════ UNHANDLED REJECTION ═══════════╗');
|
||||
console.error(`Timestamp: ${new Date().toISOString()}`);
|
||||
console.error(`Reason: ${reason}`);
|
||||
process.stdout.write(`[FATAL] Unhandled Rejection: ${reason}\n`);
|
||||
console.error('╚═══════════════════════════════════════════╝');
|
||||
});
|
||||
|
||||
// PostgreSQL numeric/decimal 타입을 JavaScript number로 자동 변환
|
||||
// PostgreSQL numeric 타입 변환
|
||||
types.setTypeParser(1700, parseFloat);
|
||||
|
||||
async function bootstrap() {
|
||||
@@ -44,13 +39,10 @@ async function bootstrap() {
|
||||
logger.log('========================================');
|
||||
logger.log('Application starting...');
|
||||
logger.log(`NODE_ENV: ${process.env.NODE_ENV}`);
|
||||
logger.log(`REDIS_URL: ${process.env.REDIS_URL}`);
|
||||
logger.log(`POSTGRES_HOST: ${process.env.POSTGRES_HOST}`);
|
||||
logger.log('========================================');
|
||||
process.stdout.write(`[BOOTSTRAP] Starting application...\n`);
|
||||
|
||||
try {
|
||||
// 로거 활성화 (Docker에서 모든 로그 출력)
|
||||
const app = await NestFactory.create(AppModule, {
|
||||
logger: ['error', 'warn', 'log', 'debug', 'verbose'],
|
||||
bufferLogs: false,
|
||||
@@ -58,7 +50,6 @@ async function bootstrap() {
|
||||
|
||||
logger.log('NestFactory.create() 완료');
|
||||
|
||||
// CORS 추가
|
||||
app.enableCors({
|
||||
origin: (origin, callback) => {
|
||||
if (!origin) return callback(null, true);
|
||||
@@ -76,47 +67,29 @@ async function bootstrap() {
|
||||
credentials: true,
|
||||
});
|
||||
|
||||
// ValidationPipe 추가
|
||||
app.useGlobalPipes(
|
||||
new ValidationPipe({
|
||||
transform: true,
|
||||
whitelist: false,
|
||||
transformOptions: {
|
||||
enableImplicitConversion: true,
|
||||
},
|
||||
transformOptions: { enableImplicitConversion: true },
|
||||
}),
|
||||
);
|
||||
|
||||
// 전역 필터 적용
|
||||
app.useGlobalFilters(new AllExceptionsFilter());
|
||||
app.useGlobalInterceptors(new LoggingInterceptor(), new TransformInterceptor());
|
||||
|
||||
// 전역 인터셉터 적용
|
||||
app.useGlobalInterceptors(
|
||||
new LoggingInterceptor(),
|
||||
new TransformInterceptor(),
|
||||
);
|
||||
|
||||
// 전역 JWT 인증 가드 적용
|
||||
const reflector = app.get(Reflector);
|
||||
app.useGlobalGuards(new JwtAuthGuard(reflector));
|
||||
|
||||
const port = process.env.PORT ?? 4000;
|
||||
await app.listen(port, '0.0.0.0');
|
||||
|
||||
logger.log('========================================');
|
||||
logger.log(`Application running on port ${port}`);
|
||||
logger.log(`Environment: ${process.env.NODE_ENV || 'development'}`);
|
||||
logger.log('========================================');
|
||||
process.stdout.write(`[BOOTSTRAP] Server listening on port ${port}\n`);
|
||||
logger.log(`✅ Server running on port ${port}`);
|
||||
|
||||
} catch (error) {
|
||||
logger.error('========================================');
|
||||
logger.error('Application failed to start!');
|
||||
logger.error('❌ Application failed to start!');
|
||||
logger.error(`Error: ${error.message}`);
|
||||
logger.error(`Stack: ${error.stack}`);
|
||||
logger.error('========================================');
|
||||
process.stdout.write(`[BOOTSTRAP] STARTUP FAILED: ${error.message}\n`);
|
||||
process.stdout.write(`[BOOTSTRAP] STACK: ${error.stack}\n`);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user