Share
Embed
Parse Overview and Hosting
A talk given at the Silicon Valley iOS Meetup about Parse and Parse Hosting.
The code for the live coding portion is here: https://github.com/ParsePlatform/LandingPageDemo
jamesjyu
July 15, 2013
Transcript
112 slides
-
Database REST API Z Z Z Server + + +
users + security Monday, July 15, 13 -
Database REST API Z Z Z Server + + +
users + security Networking Monday, July 15, 13 -
Database REST API Z Z Z Server + + +
users + security Caching Networking + Monday, July 15, 13 -
Database REST API Z Z Z Server + + +
users + security Caching Networking + + The fun stuff! Monday, July 15, 13 -
Database REST API Z Z Z Server + + +
users + security Caching Networking + + The fun stuff! Monday, July 15, 13 -
Database REST API Z Z Z Server + + +
users + security Caching Networking + + The fun stuff! no no no no no yes! Monday, July 15, 13 -
Android OS X WP8 Win 8 .NET Cloud Code REST
JavaScript Monday, July 15, 13 -
Users Facebook & Twitter Pictures Comments & Likes Location Displaying
all this data Monday, July 15, 13 -
Users Facebook & Twitter Follow Pictures Comments & Likes Location
Displaying all this data Monday, July 15, 13 -
Users Facebook & Twitter Follow Pictures Push Noti cation Comments
& Likes Location Displaying all this data Monday, July 15, 13 -
Sign up a user PFUser *user = [PFUser user]; [user
setUsername:@"Apps"]; [user setPassword:@"r0ck"]; [user signUpInBackground:...]; Monday, July 15, 13 -
Sign up a user PFUser *user = [PFUser user]; [user
setUsername:@"Apps"]; [user setPassword:@"r0ck"]; [user signUpInBackground:...]; Login a user [PFUser logInWithUsernameInBackground:@"Apps" password:@"r0ck" block:...]; Monday, July 15, 13 -
Sign up a user PFUser *user = [PFUser user]; [user
setUsername:@"Apps"]; [user setPassword:@"r0ck"]; [user signUpInBackground:...]; Login a user [PFUser logInWithUsernameInBackground:@"Apps" password:@"r0ck" block:...]; [PFUser currentUser]; Monday, July 15, 13 -
Facebook Users [PFFacebookUtils logInWithPermissions:permissions block:...]; ...even Twitter Users [PFTwitterUtils logInWithBlock:...];
[PFFacebookUtils linkUser:[PFUser currentUser] permissions:permissions block:...]; [PFTwitterUtils linkUser:[PFUser currentUser] block:...]; Monday, July 15, 13 -
PFObject *comment = [PFObject objectWithClassName:@"Comment"]; [comment setObject:@"Great pic!" forKey:@"text"]; [comment
setObject:[PFUser currentUser] forKey:@"user"]; Monday, July 15, 13 -
PFObject *comment = [PFObject objectWithClassName:@"Comment"]; [comment setObject:@"Great pic!" forKey:@"text"]; [comment
saveInBackground]; [comment setObject:[PFUser currentUser] forKey:@"user"]; Monday, July 15, 13 -
PFObject *comment = [PFObject objectWithClassName:@"Comment"]; [comment setObject:@"Great pic!" forKey:@"text"]; [comment
saveInBackground]; [comment setObject:[PFUser currentUser] forKey:@"user"]; Monday, July 15, 13 -
PFObject *comment = [PFObject objectWithClassName:@"Comment"]; [comment setObject:@"Great pic!" forKey:@"text"]; [comment
saveInBackground]; [comment setObject:[PFUser currentUser] forKey:@"user"]; [comment setObject:point forKey:@"location"]; PFGeoPoint *point = [PFGeoPoint geoPointWithLatitude:40.0 longitude:-30.0]; Monday, July 15, 13 -
PFObject *comment = [PFObject objectWithClassName:@"Comment"]; [comment setObject:@"Great pic!" forKey:@"text"]; [comment
saveInBackground]; [comment setObject:[PFUser currentUser] forKey:@"user"]; [comment setObject:point forKey:@"location"]; PFGeoPoint *point = [PFGeoPoint geoPointWithLatitude:40.0 longitude:-30.0]; Monday, July 15, 13 -
PFObject *comment = [PFObject objectWithClassName:@"Comment"]; [comment setObject:@"Great pic!" forKey:@"text"]; [comment
saveInBackground]; [comment setObject:[PFUser currentUser] forKey:@"user"]; [comment setObject:point forKey:@"location"]; PFGeoPoint *point = [PFGeoPoint geoPointWithLatitude:40.0 longitude:-30.0]; Monday, July 15, 13 -
PFObject *picture = [PFObject objectWithClassName:@"Picture"]; [picture setObject:@"Seoul nightlife" forKey:@"title"]; [picture
saveInBackground]; NSData *imageData = UIImagePNGRepresentation(image); PFFile *imageFile = [PFFile fileWithData:imageData]; [imageFile saveInBackground]; [picture setObject:imageFile forKey:@"image"]; Monday, July 15, 13 -
PFObject *picture = [PFObject objectWithClassName:@"Picture"]; [picture setObject:@"Red Hot Chili Peppers!"
forKey:@"title"]; [picture saveInBackground]; NSData *imageData = UIImagePNGRepresentation(image); PFFile *imageFile = [PFFile fileWithData:imageData]; [imageFile saveInBackground]; [picture setObject:imageFile forKey:@"image"]; Monday, July 15, 13 -
PFObject *picture = [PFObject objectWithClassName:@"Picture"]; [picture setObject:@"Red Hot Chili Peppers!"
forKey:@"title"]; [picture saveInBackground]; NSData *imageData = UIImagePNGRepresentation(image); PFFile *imageFile = [PFFile fileWithData:imageData]; [imageFile saveInBackground]; [picture setObject:imageFile forKey:@"image"]; Monday, July 15, 13 -
Users Facebook & Twitter Follow Pictures Push Noti cation Comments
& Likes Location Displaying all this data Monday, July 15, 13 -
Users Facebook & Twitter Follow Pictures Push Noti cation Comments
& Likes Location Displaying all this data Monday, July 15, 13 -
Users Facebook & Twitter Follow Pictures Push Noti cation Comments
& Likes Location Displaying all this data Monday, July 15, 13 -
Users Facebook & Twitter Follow Pictures Push Noti cation Comments
& Likes Location Displaying all this data Monday, July 15, 13 -
Users Facebook & Twitter Follow Pictures Push Noti cation Comments
& Likes Location Displaying all this data Monday, July 15, 13 -
Users Facebook & Twitter Follow Pictures Push Noti cation Comments
& Likes Location Displaying all this data Monday, July 15, 13 -
PFQuery *query = [PFQuery queryForClass:@"Picture"]; [query whereKey:@"user" equalTo:[PFUser currentUser]]; [query
whereKey:@"createdAt" greaterThan:dateOneWeekAgo]; Monday, July 15, 13 -
PFQuery *query = [PFQuery queryForClass:@"Picture"]; [query whereKey:@"user" equalTo:[PFUser currentUser]]; [query
whereKey:@"createdAt" greaterThan:dateOneWeekAgo]; [query findObjectsInBackgroundWithBlock:...]; Monday, July 15, 13 -
PFQuery *query = [PFQuery queryForClass:@"Picture"]; [query whereKey:@"user" equalTo:[PFUser currentUser]]; [query
whereKey:@"createdAt" greaterThan:dateOneWeekAgo]; [query findObjectsInBackgroundWithBlock: ^(NSArray *objects, NSError *error) { if (!error) { // The find succeeded. NSLog(@"Successfully retrieved objects!”); } else { // Log details of the failure NSLog(@"Error: %@ %@", error, [error userInfo]); } } ]; Monday, July 15, 13 -
PFUser *user = [PFUser currentUser]; PFRelation *relation = [user relationForKey:@"following"];
[relation addObject:newFriend]; Monday, July 15, 13 -
PFUser *user = [PFUser currentUser]; PFRelation *relation = [user relationForKey:@"following"];
[relation addObject:newFriend]; [relation addObject:anotherFriend]; Monday, July 15, 13 -
PFUser *user = [PFUser currentUser]; PFRelation *relation = [user relationForKey:@"following"];
[relation addObject:newFriend]; [user saveInBackground]; [relation addObject:anotherFriend]; Monday, July 15, 13 -
PFQuery *query = [PFInstallation query]; [query whereKey:@"owner" matchesQuery:peopleNearConf63]; PFInstallation *inst
= [PFInstallation currentInstallation]; [inst setObject:[PFUser currentUser] forKey:@"owner"]; Push to Query Monday, July 15, 13 -
PFQuery *query = [PFInstallation query]; [query whereKey:@"owner" matchesQuery:peopleNearConf63]; [PFPush sendPushMessageToQuery:query
withMessage:@"Mobile Dev Con Today!" error:error]; PFInstallation *inst = [PFInstallation currentInstallation]; [inst setObject:[PFUser currentUser] forKey:@"owner"]; Push to Query Monday, July 15, 13 -
Users Facebook & Twitter Follow Pictures Push Noti cation Comments
& Likes Location Displaying all this data Monday, July 15, 13 -
Users Facebook & Twitter Follow Pictures Push Noti cation Comments
& Likes Location Displaying all this data Monday, July 15, 13 -
Users Facebook & Twitter Follow Pictures Push Noti cation Comments
& Likes Location Displaying all this data Monday, July 15, 13 -
Users Facebook & Twitter Follow Pictures Push Noti cation Comments
& Likes Location Displaying all this data Monday, July 15, 13 -
01011010001010100101010101010101011110010100110110110101011001001000 01010101110101101100001001001010101011100110001010101010001011000110 10011001010011110001110010101110001110001010101011010001010100101010 01011110010100110110110101011001001000100110101010101110101101100001 10101011100110001010101010001011000110011100010011001010011110001110 10001110001010101011010001010100101010101010101011110010100110110110 01001000100110101010101110101101100001001001010101011100110001010101 11000110011100010011001010011110001110010101110001110001010101011010 00101010101010101011110010100110110110101011001001000100110101010101 01100001001001010101011100110001010101010001011000110011100010011001
10001110010101110001110001010101011010001010100101010101010101011110 10110110101011001001000100110101010101110101101100001001001010101011 01010101010001011000110011100010011001010011110001110010101110001110 01011010001010100101010101010101011110010100110110110101011001001000 01010101110101101100001001001010101011100101010111010110110000100100 01110011000101010101000101100011001110001001100101001111000111001010 11000101010101101000101010010101010101010101111001010011011011010101 It’s code in the Monday, July 15, 13 -
01011010001010100101010101010101011110010100110110110101011001001000 01010101110101101100001001001010101011100110001010101010001011000110 10011001010011110001110010101110001110001010101011010001010100101010 01011110010100110110110101011001001000100110101010101110101101100001 10101011100110001010101010001011000110011100010011001010011110001110 10001110001010101011010001010100101010101010101011110010100110110110 01001000100110101010101110101101100001001001010101011100110001010101 11000110011100010011001010011110001110010101110001110001010101011010 00101010101010101011110010100110110110101011001001000100110101010101 01100001001001010101011100110001010101010001011000110011100010011001
10001110010101110001110001010101011010001010100101010101010101011110 10110110101011001001000100110101010101110101101100001001001010101011 01010101010001011000110011100010011001010011110001110010101110001110 01011010001010100101010101010101011110010100110110110101011001001000 01010101110101101100001001001010101011100101010111010110110000100100 01110011000101010101000101100011001110001001100101001111000111001010 11000101010101101000101010010101010101010101111001010011011011010101 It’s JavaScript in the Cloud Monday, July 15, 13 -
01011010001010100101010101010101011110010100110110110101011001001000 01010101110101101100001001001010101011100110001010101010001011000110 10011001010011110001110010101110001110001010101011010001010100101010 01011110010100110110110101011001001000100110101010101110101101100001 10101011100110001010101010001011000110011100010011001010011110001110 10001110001010101011010001010100101010101010101011110010100110110110 01001000100110101010101110101101100001001001010101011100110001010101 11000110011100010011001010011110001110010101110001110001010101011010 00101010101010101011110010100110110110101011001001000100110101010101 01100001001001010101011100110001010101010001011000110011100010011001
10001110010101110001110001010101011010001010100101010101010101011110 10110110101011001001000100110101010101110101101100001001001010101011 01010101010001011000110011100010011001010011110001110010101110001110 01011010001010100101010101010101011110010100110110110101011001001000 01010101110101101100001001001010101011100101010111010110110000100100 01110011000101010101000101100011001110001001100101001111000111001010 11000101010101101000101010010101010101010101111001010011011011010101 Parse.Cloud.define("averageLikes", function(request, response) { }); var query = new Parse.Query("Photo"); query.equalTo("user", Parse.User.current()); query.find({ }); error: function() { response.error("Oops, something went wrong."); } success: function(results) { var sum = 0; for (var i = 0; i < results.length; ++i) { sum += results[i].get("likes"); } response.success(sum / results.length); }, Monday, July 15, 13 -
01011010001010100101010101010101011110010100110110110101011001001000 01010101110101101100001001001010101011100110001010101010001011000110 10011001010011110001110010101110001110001010101011010001010100101010 01011110010100110110110101011001001000100110101010101110101101100001 10101011100110001010101010001011000110011100010011001010011110001110 10001110001010101011010001010100101010101010101011110010100110110110 01001000100110101010101110101101100001001001010101011100110001010101 11000110011100010011001010011110001110010101110001110001010101011010 00101010101010101011110010100110110110101011001001000100110101010101 01100001001001010101011100110001010101010001011000110011100010011001
10001110010101110001110001010101011010001010100101010101010101011110 10110110101011001001000100110101010101110101101100001001001010101011 01010101010001011000110011100010011001010011110001110010101110001110 01011010001010100101010101010101011110010100110110110101011001001000 01010101110101101100001001001010101011100101010111010110110000100100 01110011000101010101000101100011001110001001100101001111000111001010 11000101010101101000101010010101010101010101111001010011011011010101 Is that it...? Monday, July 15, 13 -
01011010001010100101010101010101011110010100110110110101011001001000 01010101110101101100001001001010101011100110001010101010001011000110 10011001010011110001110010101110001110001010101011010001010100101010 01011110010100110110110101011001001000100110101010101110101101100001 10101011100110001010101010001011000110011100010011001010011110001110 10001110001010101011010001010100101010101010101011110010100110110110 01001000100110101010101110101101100001001001010101011100110001010101 11000110011100010011001010011110001110010101110001110001010101011010 00101010101010101011110010100110110110101011001001000100110101010101 01100001001001010101011100110001010101010001011000110011100010011001
10001110010101110001110001010101011010001010100101010101010101011110 10110110101011001001000100110101010101110101101100001001001010101011 01010101010001011000110011100010011001010011110001110010101110001110 01011010001010100101010101010101011110010100110110110101011001001000 01010101110101101100001001001010101011100101010111010110110000100100 01110011000101010101000101100011001110001001100101001111000111001010 11000101010101101000101010010101010101010101111001010011011011010101 Parse.Cloud.beforeSave("Comment", function(request, response) { }); var text = request.object.get("text"); if (text.length > 140) { request.object.set("text",text.substring(0,137 + "..."); } response.success(); Monday, July 15, 13 -
01011010001010100101010101010101011110010100110110110101011001001000 01010101110101101100001001001010101011100110001010101010001011000110 10011001010011110001110010101110001110001010101011010001010100101010 01011110010100110110110101011001001000100110101010101110101101100001 10101011100110001010101010001011000110011100010011001010011110001110 10001110001010101011010001010100101010101010101011110010100110110110 01001000100110101010101110101101100001001001010101011100110001010101 11000110011100010011001010011110001110010101110001110001010101011010 00101010101010101011110010100110110110101011001001000100110101010101 01100001001001010101011100110001010101010001011000110011100010011001
10001110010101110001110001010101011010001010100101010101010101011110 10110110101011001001000100110101010101110101101100001001001010101011 01010101010001011000110011100010011001010011110001110010101110001110 01011010001010100101010101010101011110010100110110110101011001001000 01010101110101101100001001001010101011100101010111010110110000100100 01110011000101010101000101100011001110001001100101001111000111001010 11000101010101101000101010010101010101010101111001010011011011010101 What about 3rd party APIs? Monday, July 15, 13 -
01010111010110110000100100101010101110011000101010101000101100011001 01100101001111000111001010111000111000101010101101000101010010101010 01111001010011011011010101100100100010011010101010111010110110000100 10101110011000101010101000101100011001110001001100101001111000111001 00111000101010101101000101010010101010101010101111001010011011011010 00100010011010101010111010110110000100100101010101110011000101010101 00011001110001001100101001111000111001010111000111000101010101101000 10101010101010101111001010011011011010101100100100010011010101010111 10000100100101010101110011000101010101000101100011001110001001100101 00111001010111000111000101010101101000101010010101010101010101111001
11011010101100100100010011010101010111010110110000100100101010101110 01010101000101100011001110001001100101001111000111001010111000111000 01101000101010010101010101010101111001010011011011010101100100100010 01010111010110110000100100101010101110010101011101011011000010010010 11001100010101010100010110001100111000100110010100111100011100101011 00010101010110100010101001010101010101010111100101001101101101010110 01001101010101011101011011000010010010101010111001 Parse.Cloud.httpRequest({ url: 'http://www.parse.com/', success: function(httpResponse) { console.log(httpResponse.text); }, error: function(httpResponse) { console.error('Request failed: ' + httpResponse.status); } }); Monday, July 15, 13 -
Static Hosting • Choose a domain: myapp.parseapp.com (or custom) •
Initialize your parse directory Monday, July 15, 13 -
Static Hosting • Choose a domain: myapp.parseapp.com (or custom) •
Initialize your parse directory • Create public/helloword.html Monday, July 15, 13 -
Static Hosting • Choose a domain: myapp.parseapp.com (or custom) •
Initialize your parse directory • Create public/helloword.html • Type parse deploy Monday, July 15, 13 -
Static Hosting • Choose a domain: myapp.parseapp.com (or custom) •
Initialize your parse directory • Create public/helloword.html • Type parse deploy • Your web page is live Monday, July 15, 13 -
express.js • Web framework built for node • Now with
Cloud Code + Parse JS SDK • Simple but expressive Monday, July 15, 13 -
Directory Structure -cloud/ main.js Cloud Code app.js Express code -views/
View templates hello.ejs -public/ example.html Static HTML files -stylesheets/ CSS stylesheets style.css Monday, July 15, 13 -
Hello World + Template app.get('/', function(req, res) { res.render('hello'); });
app.js Monday, July 15, 13 -
Hello World + Template <!DOCTYPE html> <html> <head> <title>Sample App</title>
</head> <body> <h1>Hello World</h1> </body> </html> hello.ejs Monday, July 15, 13 -
Hello World + Dynamic Template app.get('/', function(req, res) { res.render('hello',
{ message: 'hi' }); }); app.js Monday, July 15, 13 -
Hello World + Dynamic Template <!DOCTYPE html> <html> <head> <title>Sample
App</title> </head> <body> <h1><%= message %></h1> </body> </html> hello.ejs Monday, July 15, 13 -
Hello World + Dynamic Template app.get('/', function(req, res) { res.render('hello',
{ message: req.query.msg }); }); app.js http://myapp.parseapp.com/?msg=hi Monday, July 15, 13 -
What Else? • Full blown web apps • Admin interfaces
• Web hooks • Cloud Modules: send emails, texts charge cc’s, etc Monday, July 15, 13 -
Further Reading • Guide: parse.com/docs/cloud_code_guide • Express: expressjs.com • Anymeme:
www.anymeme.org • Anyblog: github.com/ParsePlatform/AnyBlog Monday, July 15, 13