Delete search items
This commit is contained in:
14
server.cjs
14
server.cjs
@@ -484,5 +484,19 @@ app.post("/trigger/api/searchHistory", async (req, res) => {
|
||||
conn.end();
|
||||
});
|
||||
|
||||
app.delete("/trigger/api/searchHistory", async (req, res) => {
|
||||
const conn = await pool.getConnection();
|
||||
const query = `DELETE FROM trigger_database.searchHistory WHERE id = '${req.body.id}'`;
|
||||
conn
|
||||
.query(query)
|
||||
.then((rows) => {
|
||||
res.status(200).send({ status: "success" });
|
||||
})
|
||||
.catch((err) => {
|
||||
res.status(500).send({ error: err });
|
||||
});
|
||||
conn.end();
|
||||
})
|
||||
|
||||
// app is listening on port 5000
|
||||
app.listen(5000, "0.0.0.0", () => {});
|
||||
|
||||
Reference in New Issue
Block a user