I'm developing a RESTFul API using beego framework on the server and AngularJS on the client side. Both server and client are in my laptop (still in dev). Client run on 127.0.0.1:8000 and server on 127.0.0.1:8080.
When i try to hit an endpoint (using AngularJS $http service). i get the following error:
XMLHttpRequest cannot load http://127.0.0.1:8080/v1/products/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access.
I know i have to set this CORS stuff on beego. Unfortunately, after searching google, the only answer i got was from official website (in the comment section) which is not clear enough for me. Any advice guys? what kind of code should i write and where to put it on beego? thanks.