Open jacksonthompson1 opened 7 months ago
trying to fix my /deleteBoard function. I click delete. no delete..
app.post('/deleteBoard', async (req, res) => { try { const sbId = req.body.id; console.log("req.body.id: ", req.body.id); await client.connect(); let result = await client.db("jt-quebec").collection("snowboard").findOneAndDelete({ "_id": ObjectId(sbId) }); console.log(result); res.redirect('/'); } catch (error) { console.error(error); res.status(500).send("Internal Server Error"); } finally { await client.close(); } });
here's link to the line. https://github.com/jacksonthompson1/super-duper-dollop-quebec/blob/5ac111533743e44c8e9070011e9d07111de740ed/app.js#L102****
maybe im calling it wrong in my index.ejs?
trying to fix my /deleteBoard function. I click delete. no delete..
here's link to the line. https://github.com/jacksonthompson1/super-duper-dollop-quebec/blob/5ac111533743e44c8e9070011e9d07111de740ed/app.js#L102****