13

Looking for the Best Back-end for your App ? Parse is the answer

Embed Size (px)

Citation preview

Page 1: Looking for the Best Back-end for your App ? Parse is the answer
Page 2: Looking for the Best Back-end for your App ? Parse is the answer

What's Parse?

Parse is a cloud-based data management system that allows you to quickly develop web and mobile apps.

It makes developing apps really easy by taking the back-end out of your hands.

Page 3: Looking for the Best Back-end for your App ? Parse is the answer

Table

The reason it's called a class is because you'll generally create objects from a certain class and then save that object to the database.

Class

Page 4: Looking for the Best Back-end for your App ? Parse is the answer

Types of classes

User classes store user-specific information

Installation classes are typically used to send push notifications for mobile apps.

Role classes This is called ACL (access control list) within Parse.

Product classes store in-app product data.

Custom classes are for anything else.

Page 5: Looking for the Best Back-end for your App ? Parse is the answer

cloud codes

Implementing features like push notification background jobs etc.

Mobile App Development

Perform crud operations on user class without session token

Page 6: Looking for the Best Back-end for your App ? Parse is the answer

LOGIN API

curl -X POST \ -H "X-Parse-Application-Id: QcrHa6srwyHhhu6l7QQg5eorQFYfixsZIPRHOEya" \ -H "X-Parse-REST-API-Key: nKpuSPGfizMdWW8r6hQc1JzkgtFRvmXcs2MQ62my" \ -H "X-Parse-Revocable-Session: 1" \ -H "Content-Type: application/json" \ -d '{"username":"cooldude6","password":"p_n7!-e8","phone":"415-392-0202"}' \ https://api.parse.com/1/users

Response

{ "createdAt": "2011-11-07T20:58:34.448Z", "objectId": "g7y9tkhB7O", "sessionToken": "r:pnktnjyb996sj4p156gjtp4im"

}

The sessionToken which can be used to authenticate subsequent requests as this user

Page 7: Looking for the Best Back-end for your App ? Parse is the answer

Sample cloud function

// Use Parse.Cloud.define to define as many cloud functions as you want.

// For example:

Parse.Cloud.define("hello", function(request, response) {

response.success("Hello world!");

});

Page 8: Looking for the Best Back-end for your App ? Parse is the answer

push notification

Push notifications let your application notify a user of new messages or events even when the user is not actively using your application

Page 9: Looking for the Best Back-end for your App ? Parse is the answer

Background Jobs

Background jobs are non-interactive processes that run behind the normal interactive operations.

Page 10: Looking for the Best Back-end for your App ? Parse is the answer

Parse.Cloud.job("userMigration", function(request, status) { // Set up to modify user data Parse.Cloud.useMasterKey(); // Query for all users var query = new Parse.Query(Parse.User); query.each(function(user) { // Set and save the change user.set("plan", request.params.plan); return user.save(); }).then(function() { // Set the job's success status status.success("Migration completed successfully."); }, function(error) { // Set the job's error status status.error("Uh oh, something went wrong."); });});

Page 11: Looking for the Best Back-end for your App ? Parse is the answer

WebHook

Webhook is a service which is using to process or call some events when something happens.

It is like a simple HTTP call back which is process HTTP POST method when something happens before/after in database.

Page 12: Looking for the Best Back-end for your App ? Parse is the answer

Limitations of parse webhook

1.In parse webhooks are limited to 30 seconds after that parse will be automatically terminate.

2.Only POST methods Request handled.

3.It require HTTPS connection and valid SSL certificate.

Page 13: Looking for the Best Back-end for your App ? Parse is the answer

Thanks