javascriptnode.jsauthenticationparse-serverpfuser

Trying to use PFUser on NodeJS


I have been using the standard PFUser class to create user accounts for users of an iOS app to log onto a Parse-Server.

Now I want to have this user handling feature not in an iOS app anymore, but in a web app (NodeJS precisely). I was thinking I could just use the same kind of method (coding in Javascript obviously). But that does not seem to be that simple. Is there any direction to look at, to get what I want?

I already started to look at some tutorial and read some documentation, but at this point things don't yet work.

For example, with mongodb, I tried to use:

db.createUser();
(https://docs.mongodb.com/manual/reference/method/db.createUser/)

But I always get this error:

TypeError: db.createUser is not a function

Solution

  • You can learn more about the JS SDK in the Parse JS Guide. When talking about creating users, it should be something like this:

    var user = new Parse.User();
    user.set("username", "my name");
    user.set("password", "my pass");
    user.set("email", "email@example.com");
    
    // other fields can be set just like with Parse.Object
    user.set("phone", "415-392-0202");
    try {
      await user.signUp();
      // Hooray! Let them use the app now.
    } catch (error) {
      // Show the error message somewhere and let the user try again.
      alert("Error: " + error.code + " " + error.message);
    }