Version 1.0.2 mit node_modules Verzeichnis

This commit is contained in:
ISA
2024-10-02 07:58:24 +02:00
parent f353a06b1b
commit 62b6e55a0a
68228 changed files with 4548477 additions and 651 deletions

View File

@@ -6,16 +6,23 @@ import getPool from "../../../utils/mysqlPool"; // Singleton-Pool importieren
export default async function handler(req, res) {
const pool = getPool(); // Singleton-Pool verwenden
let connection;
try {
// Verbindung abrufen
connection = await pool.getConnection();
// Ausführen der Datenbankabfrage
const query = "SELECT idprio, level, name, color FROM prio";
const [results] = await pool.query(query);
const [results] = await connection.query(query);
// Wichtig: Senden Sie die Antwort zurück
res.status(200).json(results); // Nur rows werden zurückgegeben
// Senden Sie 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 {
// Verbindung freigeben
if (connection) connection.release();
}
}