Slide 1

Slide 1 text

PARSE SERVER DREW GROSS GITHUB.COM/DREW-GROSS

Slide 2

Slide 2 text

WHAT IS PARSE? Parse SDKs Parse Server Parse Dashboard A note on security Parse Live Queries

Slide 3

Slide 3 text

Parse SDKs

Slide 4

Slide 4 text

import Parse Parse.initializeWithConfiguration(ParseClientConfiguration { $0.applicationId = "my-app" $0.server = "https://my-site.com/parse" }) let nsMeetup = PFObject(className: "Meetup") nsMeetup["name"] = "NSMeetup" nsMeetup["date"] = NSDate() nsMeetup["location"] = PFGeoPoint(latitude: 40.0, longitude: -30.0) nsMeetup.saveInBackgroundWithBlock { (success: Bool, error: NSError?) -> Void in if (success) { // The object has been saved. } }

Slide 5

Slide 5 text

let query = PFQuery(className: "Meetup") query.whereKey("name", equalTo: "NSMeetup") query.whereKey("date", greaterThan: NSDate()) query.whereKey("location", nearGeoPoint: /* ... */) query.orderByAscending("date") query.findObjectsInBackgroundWithBlock { (objects: [PFObject]?, error: NSError?) -> Void in if error == nil { // The find succeeded. } }

Slide 6

Slide 6 text

Where do I get a Parse Server?

Slide 7

Slide 7 text

RUN IT ON YOUR LAPTOP $ npm install -g parse-server mongodb-runner $ mongodb-runner start $ parse-server --appId yourAppId --masterKey yourMasterKey parse-server running on http://localhost:1337/parse

Slide 8

Slide 8 text

HIT THE DEPLOY BUTTON

Slide 9

Slide 9 text

ADD IT TO EXPRESS var app = express(); var api = new ParseServer({ databaseURI: 'mongodb://localhost:27017/meetupsParseApp', appId: 'yourAppId', masterKey: 'yourMasterKey', cloud: './cloud.js', serverURL: 'http://localhost:1337/parse', }); app.use('/parse', api); app.use('/dashboard', new ParseDashboard({ ... })); app.listen(1337);

Slide 10

Slide 10 text

var api = new ParseServer({ databaseURI: 'mongodb://localhost:27017/meetupsParseApp', appId: 'yourAppId', masterKey: 'yourMasterKey', cloud: './cloud.js', serverURL: 'http://localhost:1337/parse', verifyUserEmails: true, publicServerURL: 'http://my-site.com/parse', emailAdapter: { module: 'parse-server-simple-mailgun-adapter', options: { fromAddress: '[email protected]', domain: 'mailgun-domain', apiKey: 'mailgun-key', } } });

Slide 11

Slide 11 text

Where do I get the Parse Dashboard?

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

PARSE DASHBOARD $ npm install -g parse-dashboard $ parse-dashboard --appId yourAppId --masterKey yourMasterKey --serverURL "https://meetup-app.com/parse" The dashboard is now available at http://0.0.0.0:4040/ OR var express = require('express'); var ParseDashboard = require('parse-dashboard'); var app = express(); var dashboard = new ParseDashboard({ serverURL: "...", appId: "...", masterKey: "...", }); app.use('/dashboard', dashboard); app.listen(4040);

Slide 14

Slide 14 text

SECURITY Class Level Permissions Pointer Permissions ACLs Cloud Code

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

var publicPost = PFObject(className:"Post") var postACL = PFACL.ACLWithUser(PFUser.currentUser()) postACL.setPublicReadAccess(true) publicPost.ACL = postACL publicPost.saveInBackground()

Slide 17

Slide 17 text

LIVE QUERIES Subscribe to any Parse Query Server notifies client in real-time Powered by WebSockets

Slide 18

Slide 18 text

let query = Message.query()!.where(....) let subscription = query.subscribe() subscription.handle(Event.Created) { query, object in // Called whenever an object was created }

Slide 19

Slide 19 text

LIVE QUERY EVENTS create enter update leave delete

Slide 20

Slide 20 text

SUBSCRIPTION EVENTS connect / reconnect disconnect error

Slide 21

Slide 21 text

SERVER SETUP let api = new ParseServer({ ..., liveQuery: { classNames: ['Test', 'TestAgain'] } }); let httpServer = require('http').createServer(app); httpServer.listen(port); let parseLiveQueryServer = ParseServer.createLiveQueryServer(httpServer);

Slide 22

Slide 22 text

SERVER ARCHITECTURE

Slide 23

Slide 23 text

SCALED SERVER ARCHITECTURE

Slide 24

Slide 24 text

YOU ARE ALL SET! > github.com/ParsePlatform

Slide 25

Slide 25 text

THANK YOU!