controllers/thoughtController.js
//PUT to update thought by id
PUT to update thought by id
PUT to update thought by id
updateThought({ params, body }, res) {
          Thought.findOneAndUpdate({ _id: params.id }, body, { new: true, runValidators: true })
          .then(dbThought => {
               if (!dbThought) {
                   return res.status(404).json({ message: 'No thoughts found with that id.' });
               }
               res.json(dbThought);
          })
          .catch(err => res.json(err));
     }
updateThought ( { params , body } , res ) { Thought . findOneAndUpdate ( { _id : params . id } , body , { new : true , runValidators : true } ) . then ( dbThought => { if ( ! dbThought ) { return res . status ( 404 ) . json ( { message : 'No thoughts found with that id.' } ) ; } res . json ( dbThought ) ; } ) . catch ( err => res . json ( err ) ) ; }
PUT to update thought by id
PUT to update thought by id