📜  lieke - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:31.195000             🧑  作者: Mango

代码示例1
router.post('/:id',(req,res,next)=>{
counter = req.body.like;
TestData.update({_id:id},{$inc:{likes:counter}}).exec()
.then(result=>{
res.status(200).json({message:'liked'});
}).
catch(err=>{
res.status(500).json({error:err});
});
});