fix: API Endpoint in fetchOpcUaSettingsService für Development korrigiert
- falsches .js im API Pfad entfernt - Development lädt jetzt korrekt /api/cpl/opcuaAPIHandler - Production bleibt unverändert
This commit is contained in:
24
pages/api/cpl/opcuaAPIHandler.ts
Normal file
24
pages/api/cpl/opcuaAPIHandler.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
// /pages/api/cpl/opcuaAPIHandler.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 filePath = path.join(
|
||||
process.cwd(),
|
||||
"apiMockData",
|
||||
"SERVICE",
|
||||
"opcuaMockData.js"
|
||||
);
|
||||
|
||||
try {
|
||||
const data = await fs.readFile(filePath, "utf-8");
|
||||
res.status(200).send(data);
|
||||
} catch (error) {
|
||||
res.status(404).json({ error: "File not found" });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user