Getting CORS error when calling cloud function in back4app.
Error:
Access to XMLHttpRequest at 'https://parseapi.back4app.com/functions/hello' from origin 'http://localhost:8100' has been blocked by CORS policy: No 'Access- Control- Allow-Origin' header is present on the requested resource.
In client code cloud function implemented in home page
home.page.ts:
Parse.Cloud.run('hello').then(function (ratings) {
console.log("updated");
}).catch((error) => {
console.log(error);
console.log("fail");
});
Cloud function:
In back4app added main.js file with cloud code implementation
main.js:
Parse.Cloud.define('hello', function(req, res) {
Parse.Cloud.useMasterKey();
return 'Hi';
});