Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

express delete user

//delete user
router.delete("/:id",verifyTokenAndAdmin,async (req, res)=>{
    try{
        await User.findByIdAndDelete(req.params.id)
        res.status(200).json("User has been deleted");
    }catch(err){
        res.status(500).json(err);
    }
})
 
PREVIOUS NEXT
Tagged: #express #delete #user
ADD COMMENT
Topic
Name
8+5 =