Fake API for DELETE request
For this tutorial, we'll be using a fake API from JSONPlaceholder, and below is the endpoint.
https://jsonplaceholder.typicode.com/posts/1
Axios Delete Request Code Example
To perform a DELETE request in Axios you can call the "delete" method of the "axios" object. This method accepts the resource URL and if there's any configuration then it can be passed as the 2nd parameter.
<script> import axios from 'axios'; const response = await axios .delete('https://jsonplaceholder.typicode.com/posts/1'); console.log(response); </script>
Leave a reply