30 lines
851 B
JavaScript
30 lines
851 B
JavaScript
import express from 'express';
|
|
import pool from './db.js';
|
|
import healthRoutes from './routes/health.routes.js';
|
|
import internalRoutes from './routes/internal.routes.js';
|
|
import { initGameConfig } from './services/config.service.js';
|
|
import { initCronJobs } from './services/cron.service.js';
|
|
|
|
const app = express();
|
|
const port = process.env.PORT || 3000;
|
|
|
|
app.use(express.json());
|
|
|
|
app.get('/', (req, res) => {
|
|
res.send('Void-Genesis Sektor-Backend läuft im Dev-Modus und ist mit der DB verbunden!');
|
|
});
|
|
|
|
app.use('/api', healthRoutes);
|
|
app.use('/api/internal', internalRoutes);
|
|
|
|
async function startServer() {
|
|
await initGameConfig();
|
|
initCronJobs();
|
|
|
|
app.listen(port, () => {
|
|
console.log(`🚀 Sektor-Backend gestartet auf Port ${port}`);
|
|
console.log(`Environment: ${process.env.NODE_ENV || 'development'}`);
|
|
});
|
|
}
|
|
|
|
startServer(); |