Finished entire frontend

This commit is contained in:
2025-05-07 16:14:06 +02:00
parent 66f2919b6f
commit b10b135b39
10 changed files with 110 additions and 279 deletions

View File

@@ -2,6 +2,8 @@ import express from 'express';
import cors from 'cors';
import pathRoutes from './routes/parkRoutes.js';
import coasterRoutes from './routes/coasterRoutes.js';
import fs from 'fs';
import path from 'path';
const app = express();
const port = 3000;
@@ -15,6 +17,22 @@ app.use(cors());
app.use('/api/parks', pathRoutes);
app.use('/api/coasters', coasterRoutes);
app.get('/api/filesize', (req, res) => {
const dbPath = path.join('./database.db');
fs.stat(dbPath, (err, stats) => {
if (err) {
console.error('Fehler beim Abrufen der Dateigröße:', err);
return res.status(500).json({ error: 'Dateigröße konnte nicht ermittelt werden' });
}
res.json({
sizeBytes: stats.size,
sizeMB: (stats.size / (1024 * 1024)).toFixed(2)
});
});
});
// Start des Servers
app.listen(port, () => {
console.log(`Server läuft auf http://localhost:${port}`);