Version 1.0.1.5 delete linsColorApi.js because was mock file
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user