All checks were successful
Deploy GSM / deploy (push) Successful in 27s
- Add getTerrariaPlayers function in ssh.js for PM2 log parsing - Support German and English join/leave messages - Update rcon.js to use Terraria log parsing - Add Terraria to player fetch conditions in servers.js - Update autoshutdown.js and discordBot.js for Terraria support - Update config path to tModLoader directory - Add global error handlers in server.js - Update CLAUDE.md with deployment rules and Terraria info Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
48 lines
1.1 KiB
JavaScript
48 lines
1.1 KiB
JavaScript
import express from 'express';
|
|
import cors from 'cors';
|
|
import { config } from 'dotenv';
|
|
import authRoutes from './routes/auth.js';
|
|
import serverRoutes from './routes/servers.js';
|
|
import { initDb } from './db/init.js';
|
|
import { startAutoShutdownService } from './services/autoshutdown.js';
|
|
import { initDiscordBot } from './services/discordBot.js';
|
|
|
|
config();
|
|
|
|
// Global error handlers to prevent crashes
|
|
process.on('uncaughtException', (err) => {
|
|
console.error('[FATAL] Uncaught Exception:', err.message);
|
|
console.error(err.stack);
|
|
});
|
|
|
|
process.on('unhandledRejection', (reason, promise) => {
|
|
console.error('[ERROR] Unhandled Promise Rejection:', reason);
|
|
});
|
|
|
|
const app = express();
|
|
const PORT = process.env.PORT || 3000;
|
|
|
|
app.use(cors());
|
|
app.use(express.json());
|
|
|
|
// Initialize database
|
|
initDb();
|
|
|
|
// Routes
|
|
app.use('/api/auth', authRoutes);
|
|
app.use('/api/servers', serverRoutes);
|
|
|
|
app.get('/api/health', (req, res) => {
|
|
res.json({ status: 'ok' });
|
|
});
|
|
|
|
app.listen(PORT, '0.0.0.0', () => {
|
|
console.log(`Server running on port ${PORT}`);
|
|
|
|
// Start auto-shutdown service
|
|
startAutoShutdownService();
|
|
|
|
// Start Discord bot
|
|
initDiscordBot();
|
|
});
|