Welcoming Cloud Code to the Parse Family

We’re excited to take the platform to the next level by introducing a powerful new service called Cloud Code.

Cloud Code makes Parse a one-stop shop for mobile app development by pushing the boundaries of server code. You can now add custom validations and endpoints that are instantly and easily accessible by any client, whether it’s iOS, Android, HTML5, or via the REST API. You get all of the power of the Javascript SDK running on the Parse cloud.

For example, if you were building a restaurant review app, you’d probably want to display the average star rating for a venue. Instead of grabbing all the reviews and averaging them on the client, you could specify a custom endpoint:

Parse.Cloud.define("averageStars", function(request, response) {
  var query = new Parse.Query("Review");
  query.equalTo("restaurant", request.params.restaurant);
  query.find({
    success: function(results) {
      var sum = 0;
      for (var i = 0; i < results.length; ++i) {
        sum += results[i].get("stars");
      }
      response.success(sum / results.length);
    },
    error: function() {
      response.error("Restaurant lookup failed");
    }
  });
});

All your clients would immediately have this functionality available to them. Furthermore, if you wanted to use a more sophisticated averaging algorithm, you would be able to alter it without having to update any code in the client.

There are already over 35,000 Parse-powered mobile apps on tens of millions of mobile phones and we hope this addition helps our current and future users build even more apps.

We’ve put together a great screencast that shows you how to get up and running in minutes:

Take a look at our documentation and tutorial. And, as always, get in touch if you have any questions.

Shyam Jayaraman
September 11, 2012
blog comments powered by Disqus

Archives

Categories

RSS Feed Follow us Like us