Dunebook / codesource

0 stars 0 forks source link

how-to-build-a-crud-application-using-mern-stack/ #25

Open utterances-bot opened 2 years ago

utterances-bot commented 2 years ago

How to build a CRUD application using MERN stack - CodeSource.io

In this tutorial, we will use the MERN stack to create a CRUD application. We are going to create a simple PhoneBook app where a user

https://codesource.io/how-to-build-a-crud-application-using-mern-stack/

Abdullah-z commented 2 years ago

Thanks for the very simple and easy to understand tutorial

Abdullah-z commented 2 years ago

Facing issue while updating number from client side. While it is working fine through Postman.

Abdullah-z commented 2 years ago

Can you help?

niazrahman commented 2 years ago

You can simply use the PUT request instead of the PATCH in the backend portion here is the code example: app.put('/update-phone', async (req,res) => { const newPhone = req.body.newPhone const id = req.body.id try{ await PhoneBook.findById(id, (err,data) =>{ data.phone = newPhone data.save() res.send('Data has been updated successfully') }) }catch(err){ console.log(err) } })

It will solve your problem

Abdullah-z commented 2 years ago

Thanks it works now

vernandodev commented 2 years ago

in Update data with Axios.put (Line 71:8: 'phonebook' is not defined no-undef), where i can get phonebook.map, anyone can help ?