-1

I have a little problem... I try to GET a simple json file from my server for test (not real API).

I use VueJS and axios.

my code :

getServicesAPI() {
      axios.get("http://51.91..../dist/API/Services.json").then((response) => {
        console.log(response.data);
      });

the error message is : Access to XMLHttpRequest at 'http://51.91..../dist/API/Services.json' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Can you help me please ? Thank you very much in advance.

Syl
  • 21
  • 5

1 Answers1

1

It is saying that the server that you are connecting to is not allowing you to make this request.

You can either update the server to allow CORS, or proxy the requests. During development, adding a proxy can be done by following the devServer.proxy docs here

Daniel
  • 34,125
  • 17
  • 102
  • 150