简体   繁体   中英

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

Firstly, sorry for my bad English. I'm working with Parse server, in order to allow my teammate access my local server, I config the server like this

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

But after that, I can not executive any method. Example:

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);
});

It returns an error message like this:

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

I believe you missed to initialize the SDK:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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