diff --git a/dbConnFile.js b/dbConnFile.js index 5a92a4b..7219e1b 100644 --- a/dbConnFile.js +++ b/dbConnFile.js @@ -12,4 +12,5 @@ async function dbConnect(){ } module.exports = dbConnect; + diff --git a/postApi.js b/postApi.js index 5aaf589..7fdc394 100644 --- a/postApi.js +++ b/postApi.js @@ -18,8 +18,18 @@ app.get('/' , async (req , res) => { //post api app.post('/' , async (req , res) => { let data = await dbConnect(); - data = await data.insert(req.body); - res.send(data); + let result = await data.insert(req.body); + res.send(result); }); +//put api +app.put('/:xyz' , async(req ,res)=>{ +let data = await dbConnect(); +let result = data.updateOne( + {name:req.params.xyz} , + {$set:req.body} +) +res.send({result:"update"}) +}) + app.listen(8000); \ No newline at end of file