-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathserver.js
More file actions
29 lines (24 loc) · 922 Bytes
/
server.js
File metadata and controls
29 lines (24 loc) · 922 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// IMPORTANT: Initialize telemetry FIRST, before any other requires (especially Express)
require('./src/telemetry');
const createApp = require('./src/app');
const config = require('./src/config');
const processManager = require('./src/utils/processManager');
// Create the Express app
const app = createApp();
// Export app for testing
module.exports = app;
// Start server only if not being required by tests
if (require.main === module) {
const server = app.listen(config.PORT, () => {
console.log(`🚀 Copilot Session Viewer running at http://localhost:${config.PORT}`);
console.log(`🔧 Environment: ${config.NODE_ENV}`);
console.log(`⚡ Active processes: ${processManager.getActiveCount()}`);
});
// Graceful shutdown
process.on('SIGTERM', () => {
console.log('📛 SIGTERM received, closing server...');
server.close(() => {
console.log('✅ Server closed');
});
});
}