i'm doing a project and using json-server
and axios.js
, but i am with problem in the method delete
.
My axios.js
:
The route http://127.0.0.1:3000/people
is of the json.server
..
And the error :
Failed to load resource: the server responded with a status of 404 (Not Found)
Someone would can help me ?
Here are a few different suggestions.
1) instead of using a comma, try axios.delete('http://127.0.0.1:3000/people/' + id)
so it will just think the url is http://127.0.0.1:3000/people/3
or whatever
2) pass the id through a config object, so axios.delete('http://127.0.0.1:3000/people/', {params: {id: id})
Once you get the deleting working: I believe the response of a DELETE request is an empty object, so you'd be setting state.filtered = {}
. I assume you want the list of people without the person you just deleted?