23 lines
830 B
JavaScript
23 lines
830 B
JavaScript
import http from 'http';
|
|
import { Server as SocketIOServer } from 'socket.io';
|
|
import { createApp } from './app.js';
|
|
import { config } from './config.js';
|
|
import { setupSocketHandlers } from './socket/index.js';
|
|
import { startTtlCleanupSchedule } from './cron/cleanup.js';
|
|
const app = createApp();
|
|
const server = http.createServer(app);
|
|
const io = new SocketIOServer(server, {
|
|
cors: {
|
|
origin: '*',
|
|
methods: ['GET', 'POST', 'PATCH', 'DELETE'],
|
|
},
|
|
});
|
|
// Setup real-time Socket.io handlers & authorization
|
|
setupSocketHandlers(io);
|
|
// Start periodic 30-day TTL cleanup (runs every 24 hours)
|
|
startTtlCleanupSchedule(24);
|
|
server.listen(config.port, () => {
|
|
console.log(`🎮 [Retro Kanban Server] Running on http://localhost:${config.port}`);
|
|
console.log(`🛡️ Environment: ${config.nodeEnv}`);
|
|
});
|