refactor: last20Messages und digitale Eingänge auf API-gesteuerte Mock-Dateien umgestellt

- Start.js (last20Messages) als JS-Mock in /apiMockData/jsMockFiles gespeichert
- de.js (digitale Eingänge) in /apiMockData/SERVICE verlagert
- Beide werden über eigene API-Endpoints bzw. per Script-Tag aus Development-Verzeichnis geladen
- Kein Zugriff mehr über /public notwendig, Verhalten in DEV und PROD identisch
This commit is contained in:
Ismail Ali
2025-04-15 07:20:17 +02:00
parent c0d6567c90
commit 9e931eed0f
26 changed files with 235 additions and 29 deletions

25
pages/api/cpl/tdrData.ts Normal file
View File

@@ -0,0 +1,25 @@
// /pages/api/cpl/tdrData.ts
import { NextApiRequest, NextApiResponse } from "next";
import path from "path";
import fs from "fs/promises";
export default async function handler(
req: NextApiRequest,
res: NextApiResponse
) {
const { id } = req.query;
if (!id) {
return res.status(400).json({ error: "Missing parameter: id" });
}
const filePath = path.join(process.cwd(), "apiMockData", "TDR", `${id}.json`);
try {
const data = await fs.readFile(filePath, "utf-8");
res.status(200).json(JSON.parse(data));
} catch (error) {
res.status(404).json({ error: "File not found" });
}
}