簡體   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