WIP: Refernzkurve wird angezeigt, aber kann nicht gesetzt werden
This commit is contained in:
25
pages/api/cpl/tdrReferenceCurveAPIHandler.ts
Normal file
25
pages/api/cpl/tdrReferenceCurveAPIHandler.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
// /api/cpl/tdrReferenceCurveAPIHandler.ts
|
||||
import { NextApiRequest, NextApiResponse } from "next";
|
||||
import path from "path";
|
||||
import { promises as fs } from "fs";
|
||||
|
||||
export default async function handler(
|
||||
req: NextApiRequest,
|
||||
res: NextApiResponse
|
||||
) {
|
||||
const { slot } = req.query;
|
||||
|
||||
const filePath = path.join(
|
||||
process.cwd(),
|
||||
"apiMockData",
|
||||
"tdr-reference-curves",
|
||||
`slot${slot}.json`
|
||||
);
|
||||
|
||||
try {
|
||||
const fileContent = await fs.readFile(filePath, "utf-8");
|
||||
res.status(200).json(JSON.parse(fileContent));
|
||||
} catch (error) {
|
||||
res.status(404).json({ error: "File not found" });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user