I've been developing a React app to authenticate an user with express backend. I've tested out the express server by sending a POST request using postman and everything works fine.
But I'm getting a weird error while doing the same POST request using the React App.
I checked out the request payload and the JSON data sent is correct.
Given below is the code snippet for axios action.
export const registerUser=(userData, history) => dispatch => {
axios.post("http://localhost:5000/users/register",userData)
.then( res => {
console.log(res)
history.push("/login") } )
}
Any pointers on how to solve this issue is much appreciated.