【发布时间】:2019-10-30 12:22:59
【问题描述】:
Getting CORS error when calling cloud function in back4app.
Error:
访问 XMLHttpRequest 在 'https://parseapi.back4app.com/functions/hello' 来自原点 “http://localhost:8100”已被 CORS 策略阻止:无“访问权限- 请求的资源上存在 Control-Allow-Origin' 标头。
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';
});
【问题讨论】:
标签: back4app