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? What kind of code should I write and where to put it on Beego?