Fix jwt-token
This commit is contained in:
@@ -12,6 +12,8 @@ const { sequelize } = require('./models');
|
||||
const routes = require('./routes');
|
||||
const { initializeSocketHandlers } = require('./services/socketService');
|
||||
const AlertService = require('./services/alertService');
|
||||
const DeviceHealthService = require('./services/deviceHealthService');
|
||||
const { initializeHealthService } = require('./routes/deviceHealth');
|
||||
const seedDatabase = require('./seedDatabase');
|
||||
const errorHandler = require('./middleware/errorHandler');
|
||||
const { apiDebugMiddleware } = require('./utils/apiDebugLogger');
|
||||
@@ -152,6 +154,25 @@ async function startServer() {
|
||||
|
||||
console.log('🔄 Clear alert monitoring: ✅ Started');
|
||||
|
||||
// Initialize Device Health Monitoring Service
|
||||
const deviceHealthService = new DeviceHealthService();
|
||||
initializeHealthService(deviceHealthService); // Make it available to API routes
|
||||
deviceHealthService.start();
|
||||
console.log('🏥 Device health monitoring: ✅ Started');
|
||||
|
||||
// Graceful shutdown for device health service
|
||||
process.on('SIGTERM', () => {
|
||||
console.log('SIGTERM received, shutting down gracefully');
|
||||
deviceHealthService.stop();
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
process.on('SIGINT', () => {
|
||||
console.log('SIGINT received, shutting down gracefully');
|
||||
deviceHealthService.stop();
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
console.log(`📊 Health check: http://localhost:${PORT}/health`);
|
||||
console.log(`🌐 API endpoint: http://localhost:${PORT}/api`);
|
||||
console.log('================================================\n');
|
||||
|
||||
Reference in New Issue
Block a user