I am sending form to backend by using FormData and using multer on backend to recieve the data, it works fine on my web app but on doing the same axios call to submit data in react-native shows that data fields are being received on backend in following form
{ _parts: [ [ 'firstname', 'fahad' ], [ 'firstname', 'RAO' ] ] }
i am doing following call in my web app (which works there) and in my expo app
`
const testFOrmData = ()=>{
var data = new FormData()
data.append("firstname","fahad")
data.append("firstnae","RAO")
const adata = {
firsn:"rew"
}
axios.post("http://192.168.10.8:3309/api/testform",data)
.then((res)=>{
console.log(res)
})
alert("SANS")
}`
How to receive it in object form such that i dont have to make changes in my existing code in backend as i have so many forms and i have submitted them using form data in my web app and have to do same in mobile app but i dont want to submit without FormData(by sending object in axios)
my backend
router.post("/testform",upload.none(),(req,res)=>{
console.log(req.body)
res.json({resp:req.body})
})
Top comments (0)