No 'Access-Control-Allow-Origin' header is present on the requested resource - VueJS
<p>I'm developing a VueJS application which makes calls to an external API. When I do this:</p>

<pre><code>this.$http.get(myAPIurl)
                .then(response =&gt; {
                    return response.json();
                })
                .then(data =&gt; {
                    console.log(data);
                }); 
</code></pre>

<p>I get these 2 errors in chrome console.</p>

<pre><code>Refused to set unsafe header "Access-Control-Request-Method"

XMLHttpRequest cannot load http://xxxxxx Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access
</code></pre>

<p>How do I go about it?</p>