41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
// DBIS Core Banking System - Main Entry Point
|
|
|
|
import dotenv from 'dotenv';
|
|
import app from './integration/api-gateway/app';
|
|
import { logger } from './infrastructure/monitoring/logger';
|
|
import { validateEnvironment } from './shared/config/env-validator';
|
|
|
|
// Load environment variables
|
|
dotenv.config();
|
|
|
|
// Validate environment variables before starting
|
|
try {
|
|
validateEnvironment();
|
|
} catch (error) {
|
|
logger.error('Environment validation failed', {
|
|
error: error instanceof Error ? error.message : 'Unknown error',
|
|
});
|
|
process.exit(1);
|
|
}
|
|
|
|
const PORT = process.env.PORT || 3000;
|
|
|
|
// Start server
|
|
app.listen(PORT, () => {
|
|
logger.info(`DBIS Core Banking System started on port ${PORT}`);
|
|
logger.info(`Environment: ${process.env.NODE_ENV || 'development'}`);
|
|
logger.info(`API Documentation: http://localhost:${PORT}/api-docs`);
|
|
});
|
|
|
|
// Graceful shutdown
|
|
process.on('SIGTERM', () => {
|
|
logger.info('SIGTERM received, shutting down gracefully');
|
|
process.exit(0);
|
|
});
|
|
|
|
process.on('SIGINT', () => {
|
|
logger.info('SIGINT received, shutting down gracefully');
|
|
process.exit(0);
|
|
});
|
|
|