i have a problem, i trying do the method delete with Express, Axios and React
but they are giving error e not working...
My code with AXIOS.JS with REACT
:
remove = (name, id) => {
axios.delete('http://127.0.0.1:9000/people/' + id).
then((response => id.splice(name, 1)))
}
My EXPRESS.JS
:
app.delete('/people', function (req, res) {
res.send('DELETE request to homepage');
});
And the errors:
OPTIONS http://127.0.0.1:9000/people/0 404 (Not Found)
Failed to load http://127.0.0.1:9000/people/0: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. The response had HTTP status code 404.
Uncaught (in promise) Error: Network Error at createError (createError.js:16) at XMLHttpRequest.handleError (xhr.js:87)
Someone help me please?