Home / Snippets / Axios Delete Request Example
Axios Delete Request Example cover

Axios Delete Request Example

810

3 years ago

0 comments

In this short snippet, you will learn how to perform delete request in Axios.

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>
Do note that the resource will not be really updated on the server but it will be faked as if.
notion avatar

Alaz

Week-end developer currently experimenting with web, mobile, and all things programming.

Topics:

Frontend

Resource

Average

Average

Support Us

If you like our tutorial, support us by being our Patreon or buy us some coffee ☕️

Welcome to PostSrc V3

PostSrc Dark Logo

You have to login to favorite this