I am new to Vue.js and I am trying to build a simple iTunes search application in Vue.js. I am trying to call the api with the code below but I am having a CORS problem:
Access to fetch at 'https://itunes.apple.com/search?term=drake' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
The component code so far is:
<template>
  <div class="jumbotron">
    <h1 class="display-4">{{title}}</h1>
    <p class="lead">{{intro}}</p>
    <hr class="my-4">
    <form class="col-6 mr-auto ml-auto">
      <input class="form-control form-control-lg mb-3" type="search" placeholder="Search" aria-label="Search">
      <button class="btn btn-success btn-lg btn-block mb-3" type="submit" id="SearchBtn">Search</button>
      <!--<router-link class="btn btn-primary btn-lg btn-block" to="/next">Next</router-link>-->
    </form>
  </div>
</template>
<script>
export default {
  name: "Hero",
  props: {
    navLink: String
  },
  data: function() {
    return {
      title: "Simple Search",
      intro:
        "This is a simple hero unit, a simple jumbotron-style.",
      subintro:
        "It uses utility classes for typography and spacing to space content out."
    };
  },
  mounted: function() {
    fetch('https://itunes.apple.com/search?term=drake')
    .then(response => response.json())
    .then(data => {
      this.artist = data;
      console.log(data);
    })
  }
};
</script>
<style>
.jumbotron {
  margin-bottom: 0rem !important;
}
</style>
Any idea's?
