Struggling to enable CORS in my local app, I've been following the sails.js documentation which suggests changing the setting "allRoutes: true" for enabling cors. However, when attempting to access the Google API using Angular:
getLocation: function(val) {
return $http.get('http://maps.googleapis.com/maps/api/geocode/json', {
params: { address: val, sensor: false }
});
}
An error popped up in my Chrome console:
OPTIONS http://maps.googleapis.com/maps/api/geocode/json?address=an&sensor=false
(index):1 XMLHttpRequest cannot load http://maps.googleapis.com/maps/api/geocode/json?address=ui&sensor=false. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:1337' is therefore not allowed access. The response had HTTP status code 405.
If anyone has a solution for this, it would be greatly appreciated. Thank you!