i am learning about async/await at Node.js to make a restful api and I got a problem in the PUT and PATCH method, where for req.body it can't display the data that I want
here's the code: controllers/users
 replaceUser: async (req, res, next) => {
    //enforce that req.body must contain all the fields
    const { userId } = req.params;
    const  newUser  = req.body;
    // const result = await User.findByIdAndUpdate(userId, newUser, {new: true}).exec();
    // console.log(result)
    console.log(newUser)
    console.log(userId)
    // res.status(200).json(result);
    // console.log(userId, newUser)
},
and this code for router:
router.route('/:userId')
.get(UsersController.getUser)
.put(UsersController.replaceUser)
.patch(UsersController.updateUser)
when I enable mongoose debug, only the findone function is active, and this method works on GET and POST.
i using :
    "body-parser": "^1.18.3",
    "express": "^4.16.3",
    "express-promise-router": "^3.0.3",
    "mongoose": "^5.3.1",
i already set bodyparser middleware in my app.js.. but still won't work for PATCH and PUT methods :(
please help me. I'm stuck. thank you
 
     
     
     
     
     
    