title: Parse Javascript and Cloud Code
body: <p>I am trying to set up a simple test webpage to execute some cloud code that sends a push notification from Parse. I use back4app.com. Here is what I have so far:</p>
  
  <p>JS:</p>
  
  <pre><code>Parse.initialize('APP_ID');
  Parse.serverUrl = 'https://parseapi.back4app.com/';
  
  function sendPushNotification() {
  
      let messageBox = document.getElementById('messageBox');
      let messageToPush = messageBox.value;
  
      Parse.Cloud.run("sendPushNotification", { message: messageToPush }).then(function(result) {
          console.log("result: " + JSON.stringify(result));
      }, function(error) {
          console.log("Error: " + JSON.stringify(error));
      });
  }
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta charset="UTF-8"&gt;
          &lt;title&gt;title&lt;/title&gt;
          &lt;script src="https://unpkg.com/parse/dist/parse.min.js"&gt;&lt;/script&gt;
          &lt;script src="main.js"&gt;&lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
              Message to Push:&lt;br&gt;
              &lt;input id="messageBox" type="text" /&gt;&lt;br&gt;
              &lt;input type="button" value="Push" onclick="sendPushNotification()" /&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>But when I add some text to the text box, I get these errors:</p>
  
  <pre><code>[Error] Failed to load resource: The certificate for this server is invalid. You might be connecting to a server that is pretending to be “api.parse.com” which could put your confidential information at risk. (sendPushNotification, line 0)
  </code></pre>
  
  <p>What is going wrong? In the Parse Developers JS Guide, it says:</p>
  
  <blockquote>
    <p>To initialize your own Parse-Server with Javascript, you should
    replace your current initialization code with this</p>
  
  <pre><code>Parse.initialize("YOUR_APP_ID"); 
  Parse.serverURL = 'http://YOUR_PARSE_SERVER:1337/parse'
  </code></pre>
  </blockquote>
  
  <p>I used the back4app url that I use in my iOS app. So confused</p>