I'm stuck on something. I test my api from chome postman app with requests like:
http://localhost:50000/api/user/user_name/machines
and it works. I started building front end in vue.js and try the following:
getReports() {
this.$http
.get('http://localhost:50000/api/user/user_name/machines', (data) => {
this.data = data;
})
.error((err) => console.log(err))
}
and of course i get
XMLHttpRequest cannot load http://localhost:50000/api/user/user_name/machines. 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.
I previously try some react.js and came across same problem so like then i just added
services.AddCors();
and
app.UseCors(builder => builder.AllowAnyOrigin());
to my startup.cs file but no luck this time. I remember it worked on react.js. I can also get data directly from the browser - just by going to this url. Why vue.js has problems?
my startup.cs file: http://pastebin.pl/view/b93c9e2c