云代码的解析服务器问题
Parse-server problems with cloud code.
我已经将解析服务器部署到heroku(mLab.com 作为数据库),但是云代码遇到了一些问题。
当调用"hello"函数时,一切都可以正常工作。
调用"testFunction"时,它反过来发出查询请求,我收到此错误:
XMLHttpRequest cannot load https://xxxxx.herokuapp.com/parse/functions/testFunction.
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://127.0.0.1:51488' is therefore not allowed access.
The response had HTTP status code 503.
一直在玩猫,没有任何运气。任何建议将不胜感激。
------------ CLIENT ------------
Parse.initialize("xxxxxx");
Parse.serverURL = 'https://xxxxx.herokuapp.com/parse/'
Parse.Cloud.run('hello').then(function (result) {
console.log(result);
});
Parse.Cloud.run('testFunction').then(function (result) {
console.log(result);
});
------------ SERVER -----------
Parse.Cloud.define('hello', function (req, res) {
res.success('Hi');
});
Parse.Cloud.define("testFunction", function (request, response) {
var query = new Parse.Query("Jobs");
query.find().then(function (result) {
response.success("Success: " + result);
});
});
找出
问题所在。我忘了在 heroku 的环境变量中添加SERVER_URL。
相关文章:
- Node.js服务器问题-已添加“/"在浏览器中查找文件时
- 创建服务器控件.创建问题
- 从第三方服务器发出解析json的问题
- 在服务器上通过jQueryAjax上传加载的图像时出现问题
- Python本地服务器问题:通过ajax发布时,rfile被截断
- 云代码的解析服务器问题
- 当服务器从 http 更改为 https 时,有哪些可能的方法可以解决问题
- 客户端和服务器端调用 asp 按钮的问题
- 从android连接到node.js服务器时出现问题
- 'simple'套接字中的作用域问题.IO服务器
- node.js http服务器并发问题
- 通过flask服务器上的队列访问d3.json对象时出现问题
- 客户端内服务器端经典ASP代码的问题<脚本>标签
- 在不同端口上运行时,rest api应用程序服务器(express)和Angulars js应用程序之间的Cors问题
- 在快递服务器问题中设置“邮政”路由时遇到困难
- 节点服务器问题
- Ajax写入服务器问题
- “BOT"服务器问题,没有做好它的工作
- 长轮询导致服务器问题
- 本地vs服务器问题的HTML页面