get data from databse using api and mongo db | nodejs tutorials

api


http://localhost:3000/get

app.get('/get',async (req, res)=> {

PERSON_SCHEMA.find().then(result =>
{
res.send(result)
}).catch(err => {
res.send("faile")
})
})



app.get('/get-await',async (req, res)=> {

let listDetails= await PERSON_SCHEMA.find({});
res.send(listDetails);
})

 

No comments:

Post a Comment

sun dried potato procedure

  Sun-Dried Potato Chips Recipe  https://www.youtube.com/watch?v=e_PVvAU77Qs , recipe for potato sun dried chips 1) ist peel off the potato ...