Test Parse Server

by Wesley Smith

HTML

<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
<script src="https://dodsoftware.com/sotests/resources/js/parse.js"></script>
<h4>Edit the JS example with your parse server details to test your setup</h4>
<h4 style="color:red">Remember to click "Run" after you make your changes</h4>
<button id="test" class="btn btn-primary">Test Parse-Server Setup</button>
<div id="results"></div>

CSS

/* Latest compiled and minified CSS included as External Resource*/


/* Optional theme 
@import url('//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css');
body {
    margin: 10px;
}*/
#test{
  margin-bottom:22px;
}

JavaScript

$('#test').click(function() {
  var $result=$('#results').html('Testing configuration.....');
  Parse.initialize('<MY_APP_ID>', '<MY_JS_KEY>');
  Parse.serverURL = 'https://<MY_HEROKU_APP_NAME>.herokuapp.com/Parse'

  var ParseServerTest = Parse.Object.extend('ParseServerTest');
  var _ParseServerTest = new ParseServerTest();

  _ParseServerTest.set('key', 'value');
  _ParseServerTest.save(null, {
    success: function(_ParseServerTest) {
      var txt = 'Yay, your server works! New object created with objectId: ' + _ParseServerTest.id;
      $result.html('<div class="alert alert-success" role="alert">' + txt + '</div>');
    },
    error: function(_ParseServerTest, error) {
      var txt = 'Bummer, Failed to create new object, with error code: ' + error.message;
      $result.html('<div class="alert alert-danger" role="alert">' + txt + '</div>');
    }
  });

});