"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const app_1 = __importDefault(require("./app"));
const logger_1 = require("./config/logger");
const database_1 = __importDefault(require("./config/database"));
const redis_1 = require("./config/redis");
const backup_service_1 = require("./services/backup.service");
const scheduler_service_1 = require("./services/scheduler.service");
const PORT = process.env.PORT || 5000;
async function bootstrap() {
    try {
        await database_1.default.$connect();
        logger_1.logger.info('Database connected successfully');
        await (0, redis_1.connectRedis)();
        backup_service_1.BackupService.initialize();
        scheduler_service_1.SchedulerService.initialize();
        app_1.default.listen(PORT, () => {
            logger_1.logger.info(`Server running on port ${PORT} in ${process.env.NODE_ENV || 'development'} mode`);
        });
    }
    catch (error) {
        logger_1.logger.error('Failed to start server:', error);
        process.exit(1);
    }
}
bootstrap();
//# sourceMappingURL=server.js.map