Add config system for training, trainer, membership and impressum with CMS editor

This commit is contained in:
Torsten Schulz (local)
2025-10-21 16:44:31 +02:00
parent 2b4db04ea1
commit d5a181e0c8
96 changed files with 1140 additions and 4600 deletions

30
server/api/config.get.js Normal file
View File

@@ -0,0 +1,30 @@
import { promises as fs } from 'fs'
import path from 'path'
const getDataPath = (filename) => {
const cwd = process.cwd()
if (cwd.endsWith('.output')) {
return path.join(cwd, '../server/data', filename)
}
return path.join(cwd, 'server/data', filename)
}
export default defineEventHandler(async (event) => {
try {
const configFile = getDataPath('config.json')
const data = await fs.readFile(configFile, 'utf-8')
const config = JSON.parse(data)
return {
success: true,
config
}
} catch (error) {
console.error('Fehler beim Laden der Config:', error)
throw createError({
statusCode: 500,
message: 'Fehler beim Laden der Konfiguration.'
})
}
})