i have a problem with axios.js, i trying to use the method POST but it give error 404 and i dont know what do, the error is:
> POST http://localhost:3000/api/match 404 (Not Found)
> createError.js:16 Uncaught (in promise) Error: Request failed with status code 404
at createError (createError.js:16)
at settle (settle.js:18)
at XMLHttpRequest.handleLoad (xhr.js:77)
My code with post:
teste = () => {
console.log('login clicked')
let data = JSON.stringify({
password: this.state.password,
username: this.state.email
})
axios.post('api/match', data, {
headers: {
'Content-Type': 'application/json',
}
})
}
Same thing if i to use this:
axios.post('http://localhost:3001/api/match', data, {
headers: {
'Content-Type': 'application/json',
}
})
My package.json:
"proxy": "http://localhost:3001/"
Someone know why be giving this error? ???? I look that it is giving the URL of the app React and not of the server..
Someone help me please?