how to consume a rest api in vuejs code example

Example 1: how to use axios in vue

//Install Axios from terminal
npm install axios
//Import Axios in your HelloWorld.vue
import axios from 'axios'
//Add a method to implement Axios
test () {
      axios.post('URL')
      .then(function (response) {
        alert (response.data);
      })
      .catch(function (error) {
        alert(error);
      });
    }

Example 2: http requests in vue 3

# http requests using Fetcht api in Vue 3 explained (see videos below) 
# https://www.youtube.com/watch?v=-Aoyja_BjZY
# https://www.youtube.com/watch?v=LvOYCjpMQ10