I am following a tutorial. I matched everything with the tutorial but my code is not working. It is giving undefined output. I couldn't find where is the mistake and why is it happening?
app.get("/appointment", async (req,res)=>{
const patient = req.query.patient;
console.log(patient);
const query = { patient: patient };
// console.log(query)
const appointments = await appointmentCollection.find(query).toArray();
res.send(appointments)
})
console.log(patient); giving undefined. and res.send(appointments) give an empty array. Please help.