繁体   English   中英

在配置用户名和密码以允许用户访问我的 Parse 服务器后,如何运行任何 JS function?

[英]How can I run any JS function after config the username and password to allow user access my Parse Server?

首先,对不起我的英语不好。 我正在使用 Parse 服务器,为了让我的队友访问我的本地服务器,我像这样配置服务器

{
    "apps": [
      {
        "serverURL": "http://10.30.176.147:1337/parse",
        "appId": "MyFirstApp",
        "masterKey": "myMasterKey",
        "appName": "MyApplication"
      }
    ],
    "users": 
    [
      {
          "user":"admin",
          "pass":"pass"
      }
    ]
}

但在那之后,我无法执行任何方法。 例子:

Parse.serverURL = 'http://10.30.176.147:1337/parse';

var user = new Parse.User();

user.set("username", "alex@gmail.com.vn");
user.set("password", "123456");
user.set("email", "alex@gmail.com.vn");
user.set("foo", "bar");
user.set("name", "Alex Ho");
user.set("gender", "female");

user.signUp().then(function success(){
  console.log("Signed up", user);
}, function error(err){
  console.error(err);
});

它返回如下错误消息:

[object Object] { code: 100, message: "XMLHttpRequest failed: "Unable to connect to the Parse API"" }

我相信你错过了初始化 SDK:

Parse.initialize("MyFirstApp", null, "myMasterKey");

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM