Version 1.0.1.5 delete linsColorApi.js because was mock file

This commit is contained in:
ISA
2024-09-05 11:53:21 +02:00
parent 3d8ecb8287
commit 094e27e147
2 changed files with 6 additions and 65 deletions

View File

@@ -4,16 +4,21 @@
import getPool from "../../utils/mysqlPool"; // Verwende den Singleton-Pool
export default async function handler(req, res) {
let connection;
try {
const pool = getPool(); // Hole den Pool
connection = await pool.getConnection(); // Hole die Verbindung
// Führe die Abfrage aus
const [results] = await pool.query("SELECT id, name FROM area WHERE id = ?", [req.query.id]);
const [results] = await connection.query("SELECT id, name FROM area WHERE id = ?", [req.query.id]);
// Sende die Antwort zurück
res.status(200).json(results);
} catch (error) {
console.error("Fehler beim Abrufen der API", error);
res.status(500).json({ error: "Fehler bei der Abfrage" });
} finally {
if (connection) connection.release(); // Gib die Verbindung zurück in den Pool
}
}