git commit -m "feat: Mock-API über /api/mockData/webService erfolgreich implementiert 🚀
- JSON-Dateien aus /webServiceMockdata als echte API-Mocks verfügbar - API-Endpunkte unter /api/mockData/webService/ hinzugefügt - Fehlerhafte Platzhalter in den API-Handlern korrigiert - Alle Mock-URLs in config.js auf die neuen API-Routen umgestellt - Tests erfolgreich durchgeführt, Mock-API funktioniert einwandfrei"
This commit is contained in:
15
pages/api/mockData/webService/CablesStaticMock.js
Normal file
15
pages/api/mockData/webService/CablesStaticMock.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
export default function handler(req, res) {
|
||||
const filePath = path.join(process.cwd(), "webServiceMockdata", "CablesStaticMock.json");
|
||||
|
||||
try {
|
||||
const fileContent = fs.readFileSync(filePath, "utf8");
|
||||
const data = JSON.parse(fileContent);
|
||||
res.status(200).json(data);
|
||||
} catch (error) {
|
||||
console.error(`Error reading CablesStaticMock.json:`, error);
|
||||
res.status(500).json({ message: "Error loading mock data" });
|
||||
}
|
||||
}
|
||||
15
pages/api/mockData/webService/GetIconsStaticMock.js
Normal file
15
pages/api/mockData/webService/GetIconsStaticMock.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
export default function handler(req, res) {
|
||||
const filePath = path.join(process.cwd(), "webServiceMockdata", "GetIconsStaticMock.json");
|
||||
|
||||
try {
|
||||
const fileContent = fs.readFileSync(filePath, "utf8");
|
||||
const data = JSON.parse(fileContent);
|
||||
res.status(200).json(data);
|
||||
} catch (error) {
|
||||
console.error(`Error reading GetIconsStaticMock.json:`, error);
|
||||
res.status(500).json({ message: "Error loading mock data" });
|
||||
}
|
||||
}
|
||||
15
pages/api/mockData/webService/GisStationsMeasurementsMock.js
Normal file
15
pages/api/mockData/webService/GisStationsMeasurementsMock.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
export default function handler(req, res) {
|
||||
const filePath = path.join(process.cwd(), "webServiceMockdata", "GisStationsMeasurementsMock.json");
|
||||
|
||||
try {
|
||||
const fileContent = fs.readFileSync(filePath, "utf8");
|
||||
const data = JSON.parse(fileContent);
|
||||
res.status(200).json(data);
|
||||
} catch (error) {
|
||||
console.error(`Error reading GisStationsMeasurementsMock.json:`, error);
|
||||
res.status(500).json({ message: "Error loading mock data" });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
export default function handler(req, res) {
|
||||
const filePath = path.join(process.cwd(), "webServiceMockdata", "GisStationsStaticDistrictMock.json");
|
||||
|
||||
try {
|
||||
const fileContent = fs.readFileSync(filePath, "utf8");
|
||||
const data = JSON.parse(fileContent);
|
||||
res.status(200).json(data);
|
||||
} catch (error) {
|
||||
console.error(`Error reading GisStationsStaticDistrictMock.json:`, error);
|
||||
res.status(500).json({ message: "Error loading mock data" });
|
||||
}
|
||||
}
|
||||
15
pages/api/mockData/webService/GisStationsStaticMock.js
Normal file
15
pages/api/mockData/webService/GisStationsStaticMock.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
export default function handler(req, res) {
|
||||
const filePath = path.join(process.cwd(), "webServiceMockdata", "GisStationsStaticMock.json");
|
||||
|
||||
try {
|
||||
const fileContent = fs.readFileSync(filePath, "utf8");
|
||||
const data = JSON.parse(fileContent);
|
||||
res.status(200).json(data);
|
||||
} catch (error) {
|
||||
console.error(`Error reading GisStationsStaticMock.json:`, error);
|
||||
res.status(500).json({ message: "Error loading mock data" });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
export default function handler(req, res) {
|
||||
const filePath = path.join(process.cwd(), "webServiceMockdata", "GisStationsStatusDistrictMock.json");
|
||||
|
||||
try {
|
||||
const fileContent = fs.readFileSync(filePath, "utf8");
|
||||
const data = JSON.parse(fileContent);
|
||||
res.status(200).json(data);
|
||||
} catch (error) {
|
||||
console.error(`Error reading GisStationsStatusDistrictMock.json:`, error);
|
||||
res.status(500).json({ message: "Error loading mock data" });
|
||||
}
|
||||
}
|
||||
15
pages/api/mockData/webService/GisStationsStatusMock.js
Normal file
15
pages/api/mockData/webService/GisStationsStatusMock.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
export default function handler(req, res) {
|
||||
const filePath = path.join(process.cwd(), "webServiceMockdata", "GisStationsStatusMock.json");
|
||||
|
||||
try {
|
||||
const fileContent = fs.readFileSync(filePath, "utf8");
|
||||
const data = JSON.parse(fileContent);
|
||||
res.status(200).json(data);
|
||||
} catch (error) {
|
||||
console.error(`Error reading GisStationsStatusMock.json:`, error);
|
||||
res.status(500).json({ message: "Error loading mock data" });
|
||||
}
|
||||
}
|
||||
15
pages/api/mockData/webService/GisSystemStaticMock.js
Normal file
15
pages/api/mockData/webService/GisSystemStaticMock.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
export default function handler(req, res) {
|
||||
const filePath = path.join(process.cwd(), "webServiceMockdata", "GisSystemStaticMock.json");
|
||||
|
||||
try {
|
||||
const fileContent = fs.readFileSync(filePath, "utf8");
|
||||
const data = JSON.parse(fileContent);
|
||||
res.status(200).json(data);
|
||||
} catch (error) {
|
||||
console.error(`Error reading GisSystemStaticMock.json:`, error);
|
||||
res.status(500).json({ message: "Error loading mock data" });
|
||||
}
|
||||
}
|
||||
15
pages/api/mockData/webService/KueStaticMock.js
Normal file
15
pages/api/mockData/webService/KueStaticMock.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
export default function handler(req, res) {
|
||||
const filePath = path.join(process.cwd(), "webServiceMockdata", "KueStaticMock.json");
|
||||
|
||||
try {
|
||||
const fileContent = fs.readFileSync(filePath, "utf8");
|
||||
const data = JSON.parse(fileContent);
|
||||
res.status(200).json(data);
|
||||
} catch (error) {
|
||||
console.error(`Error reading KueStaticMock.json:`, error);
|
||||
res.status(500).json({ message: "Error loading mock data" });
|
||||
}
|
||||
}
|
||||
15
pages/api/mockData/webService/KueStatusMock.js
Normal file
15
pages/api/mockData/webService/KueStatusMock.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
export default function handler(req, res) {
|
||||
const filePath = path.join(process.cwd(), "webServiceMockdata", "KueStatusMock.json");
|
||||
|
||||
try {
|
||||
const fileContent = fs.readFileSync(filePath, "utf8");
|
||||
const data = JSON.parse(fileContent);
|
||||
res.status(200).json(data);
|
||||
} catch (error) {
|
||||
console.error(`Error reading KueStatusMock.json:`, error);
|
||||
res.status(500).json({ message: "Error loading mock data" });
|
||||
}
|
||||
}
|
||||
15
pages/api/mockData/webService/ServicesStaticMock.js
Normal file
15
pages/api/mockData/webService/ServicesStaticMock.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
export default function handler(req, res) {
|
||||
const filePath = path.join(process.cwd(), "webServiceMockdata", "ServicesStaticMock.json");
|
||||
|
||||
try {
|
||||
const fileContent = fs.readFileSync(filePath, "utf8");
|
||||
const data = JSON.parse(fileContent);
|
||||
res.status(200).json(data);
|
||||
} catch (error) {
|
||||
console.error(`Error reading ServicesStaticMock.json:`, error);
|
||||
res.status(500).json({ message: "Error loading mock data" });
|
||||
}
|
||||
}
|
||||
15
pages/api/mockData/webService/StationsStaticMock.js
Normal file
15
pages/api/mockData/webService/StationsStaticMock.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
export default function handler(req, res) {
|
||||
const filePath = path.join(process.cwd(), "webServiceMockdata", "StationsStaticMock.json");
|
||||
|
||||
try {
|
||||
const fileContent = fs.readFileSync(filePath, "utf8");
|
||||
const data = JSON.parse(fileContent);
|
||||
res.status(200).json(data);
|
||||
} catch (error) {
|
||||
console.error(`Error reading StationsStaticMock.json:`, error);
|
||||
res.status(500).json({ message: "Error loading mock data" });
|
||||
}
|
||||
}
|
||||
15
pages/api/mockData/webService/StationsStatusMock.js
Normal file
15
pages/api/mockData/webService/StationsStatusMock.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
export default function handler(req, res) {
|
||||
const filePath = path.join(process.cwd(), "webServiceMockdata", "StationsStatusMock.json");
|
||||
|
||||
try {
|
||||
const fileContent = fs.readFileSync(filePath, "utf8");
|
||||
const data = JSON.parse(fileContent);
|
||||
res.status(200).json(data);
|
||||
} catch (error) {
|
||||
console.error(`Error reading StationsStatusMock.json:`, error);
|
||||
res.status(500).json({ message: "Error loading mock data" });
|
||||
}
|
||||
}
|
||||
15
pages/api/mockData/webService/StatusTALASMock.js
Normal file
15
pages/api/mockData/webService/StatusTALASMock.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
export default function handler(req, res) {
|
||||
const filePath = path.join(process.cwd(), "webServiceMockdata", "StatusTALASMock.json");
|
||||
|
||||
try {
|
||||
const fileContent = fs.readFileSync(filePath, "utf8");
|
||||
const data = JSON.parse(fileContent);
|
||||
res.status(200).json(data);
|
||||
} catch (error) {
|
||||
console.error(`Error reading StatusTALASMock.json:`, error);
|
||||
res.status(500).json({ message: "Error loading mock data" });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user