diff --git a/index.js b/index.js index bda39f3..d2447ff 100644 --- a/index.js +++ b/index.js @@ -330,6 +330,26 @@ app.post("/api/teams", async (req, res) => { } }); +//Team löschen + +app.delete("/api/teams/:id", async (req, res) => { + const { id } = req.params; + + try { + const result = await pool.query("DELETE FROM teams WHERE id = $1", [id]); + + if (result.rowCount === 0) { + return res.status(404).send("Team nicht gefunden"); + } + + res.send("Team gelöscht"); + } catch (err) { + console.error("Fehler beim Löschen:", err); + res.status(500).send("Fehler beim Löschen"); + } +}); + + // Server starten app.listen(port, () => { const nets = os.networkInterfaces();