From 8271778e3b975f8b4f7b2bf3e8dfbcca72ecdeea Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Sat, 6 Feb 2016 22:33:44 -0800 Subject: [PATCH 01/31] Add a client key --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index a196c911b4..7f1447fc66 100644 --- a/index.js +++ b/index.js @@ -14,7 +14,8 @@ var api = new ParseServer({ databaseURI: databaseUri || 'mongodb://localhost:27017/dev', cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js', appId: process.env.APP_ID || 'myAppId', - masterKey: process.env.MASTER_KEY || '' //Add your master key here. Keep it secret! + masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it secret! + clientKey: process.env.CLIENT_KEY || 'clientKey', }); // Client-keys like the javascript key or the .NET key are not necessary with parse-server // If you wish you require them, you can set them as options in the initialization above: From b693df7d70e99e719e96e624fee8c97ab8b11f91 Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Wed, 10 Feb 2016 00:46:41 -0800 Subject: [PATCH 02/31] Add Client Key since I think the Parse Android client still needs it. --- .ebextensions/app.config | 1 + app.json | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/.ebextensions/app.config b/.ebextensions/app.config index 598826f856..d3bfd1d5d6 100644 --- a/.ebextensions/app.config +++ b/.ebextensions/app.config @@ -2,6 +2,7 @@ option_settings: aws:elasticbeanstalk:application:environment: PARSE_MOUNT: "/parse" APP_ID: "ReplaceWithAppID" + CLIENT_KEY: "ReplaceWithClientKey" MASTER_KEY: "ReplaceWithMasterKey" DATABASE_URI: "ReplaceWithDatabaseURI" NODE_ENV: "production" diff --git a/app.json b/app.json index a4b9a67dc3..c2dd0e1a11 100644 --- a/app.json +++ b/app.json @@ -16,6 +16,10 @@ "MASTER_KEY": { "description": "A key that overrides all permissions. Keep this secret.", "value": "myMasterKey" + }, + "CLIENT_KEY": { + "description": "A key that overrides all permissions. Keep this secret.", + "value": "clientKey" } }, "image": "heroku/nodejs", From 5196adf975e7f826c05354fcd28ada000b407ea5 Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Wed, 10 Feb 2016 01:03:29 -0800 Subject: [PATCH 03/31] Add GCM support to the env variables. --- index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/index.js b/index.js index 7f1447fc66..1059546b71 100644 --- a/index.js +++ b/index.js @@ -10,12 +10,20 @@ if (!databaseUri) { console.log('DATABASE_URI not specified, falling back to localhost.'); } +var pushConfig = {}; + +if (process.env.GCM_ENABLE) { + pushConfig['android'] = { senderId: process.env.GCM_SENDER_ID || '', + apiKey: process.env.GCM_API_KEY || ''}; +} + var api = new ParseServer({ databaseURI: databaseUri || 'mongodb://localhost:27017/dev', cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js', appId: process.env.APP_ID || 'myAppId', masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it secret! clientKey: process.env.CLIENT_KEY || 'clientKey', + push: pushConfig }); // Client-keys like the javascript key or the .NET key are not necessary with parse-server // If you wish you require them, you can set them as options in the initialization above: From 6cea7efa34b3ac3049ffbc061aebe208b251de78 Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Wed, 10 Feb 2016 01:27:21 -0800 Subject: [PATCH 04/31] Revert "Add Client Key since I think the Parse Android client still needs it." This reverts commit b693df7d70e99e719e96e624fee8c97ab8b11f91. --- .ebextensions/app.config | 1 - app.json | 4 ---- 2 files changed, 5 deletions(-) diff --git a/.ebextensions/app.config b/.ebextensions/app.config index d3bfd1d5d6..598826f856 100644 --- a/.ebextensions/app.config +++ b/.ebextensions/app.config @@ -2,7 +2,6 @@ option_settings: aws:elasticbeanstalk:application:environment: PARSE_MOUNT: "/parse" APP_ID: "ReplaceWithAppID" - CLIENT_KEY: "ReplaceWithClientKey" MASTER_KEY: "ReplaceWithMasterKey" DATABASE_URI: "ReplaceWithDatabaseURI" NODE_ENV: "production" diff --git a/app.json b/app.json index c2dd0e1a11..a4b9a67dc3 100644 --- a/app.json +++ b/app.json @@ -16,10 +16,6 @@ "MASTER_KEY": { "description": "A key that overrides all permissions. Keep this secret.", "value": "myMasterKey" - }, - "CLIENT_KEY": { - "description": "A key that overrides all permissions. Keep this secret.", - "value": "clientKey" } }, "image": "heroku/nodejs", From 30564bd1492524df48a954728d4f2b6663d7f5df Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Wed, 17 Feb 2016 10:17:20 -0800 Subject: [PATCH 05/31] Add javaScript key too --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index 1059546b71..ea4a99b98b 100644 --- a/index.js +++ b/index.js @@ -23,6 +23,7 @@ var api = new ParseServer({ appId: process.env.APP_ID || 'myAppId', masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it secret! clientKey: process.env.CLIENT_KEY || 'clientKey', + javascriptKey: process.env.CLIENT_KEY || 'javascriptKey', push: pushConfig }); // Client-keys like the javascript key or the .NET key are not necessary with parse-server From 4ebbf5b05ca54a8d041ffde8b094fe5712d7e985 Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Wed, 17 Feb 2016 10:19:17 -0800 Subject: [PATCH 06/31] Rename to JAVASCRIPT_KEY --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index ea4a99b98b..99c67857c3 100644 --- a/index.js +++ b/index.js @@ -23,7 +23,7 @@ var api = new ParseServer({ appId: process.env.APP_ID || 'myAppId', masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it secret! clientKey: process.env.CLIENT_KEY || 'clientKey', - javascriptKey: process.env.CLIENT_KEY || 'javascriptKey', + javascriptKey: process.env.JAVASCRIPT_KEY || 'javascriptKey', push: pushConfig }); // Client-keys like the javascript key or the .NET key are not necessary with parse-server From 3cdbe040b83d03bba1fc5e7b1d5a4c4fe68c31ff Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Fri, 19 Feb 2016 00:27:22 -0800 Subject: [PATCH 07/31] Add support for S3 File Adapter --- index.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 99c67857c3..95e5ce9214 100644 --- a/index.js +++ b/index.js @@ -17,6 +17,17 @@ if (process.env.GCM_ENABLE) { apiKey: process.env.GCM_API_KEY || ''}; } +var filesAdapter = null; // enable Gridstore to be the default +if (process.env.S3_ENABLE) { + var S3Adapter = require('parse-server').S3Adapter; + + filesAdapter = new S3Adapter( + process.env.AWS_ACCESS_KEY, + process.env.AWS_SECRET_ACCESS_KEY, + {bucket: process.env.AWS_BUCKET_NAME, bucketPrefix: "", directAccess: true} + ); +} + var api = new ParseServer({ databaseURI: databaseUri || 'mongodb://localhost:27017/dev', cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js', @@ -24,7 +35,8 @@ var api = new ParseServer({ masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it secret! clientKey: process.env.CLIENT_KEY || 'clientKey', javascriptKey: process.env.JAVASCRIPT_KEY || 'javascriptKey', - push: pushConfig + push: pushConfig, + filesAdapter: filesAdapter }); // Client-keys like the javascript key or the .NET key are not necessary with parse-server // If you wish you require them, you can set them as options in the initialization above: From 913c7fdbc9e3fde6f2d2b4e45871ecad374c9a7b Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Wed, 24 Feb 2016 01:19:50 -0800 Subject: [PATCH 08/31] Add serverURL as an environment variable option --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 95e5ce9214..7a2b95da09 100644 --- a/index.js +++ b/index.js @@ -36,7 +36,8 @@ var api = new ParseServer({ clientKey: process.env.CLIENT_KEY || 'clientKey', javascriptKey: process.env.JAVASCRIPT_KEY || 'javascriptKey', push: pushConfig, - filesAdapter: filesAdapter + filesAdapter: filesAdapter, + serverURL: process.env.SERVER_URL // needed for Parse Cloud and push notifications }); // Client-keys like the javascript key or the .NET key are not necessary with parse-server // If you wish you require them, you can set them as options in the initialization above: From 05bd478a7c9e52dbc05b19fcaa6b43ab5c144b3a Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Tue, 1 Mar 2016 23:50:10 -0800 Subject: [PATCH 09/31] Default to http://localhost/parse --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 7a2b95da09..250be154b9 100644 --- a/index.js +++ b/index.js @@ -37,7 +37,7 @@ var api = new ParseServer({ javascriptKey: process.env.JAVASCRIPT_KEY || 'javascriptKey', push: pushConfig, filesAdapter: filesAdapter, - serverURL: process.env.SERVER_URL // needed for Parse Cloud and push notifications + serverURL: process.env.SERVER_URL || 'http://localhost/parse' // needed for Parse Cloud and push notifications }); // Client-keys like the javascript key or the .NET key are not necessary with parse-server // If you wish you require them, you can set them as options in the initialization above: From d17f383b300c7aaacad6d3a0ec7cf8a9da050792 Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Wed, 2 Mar 2016 01:10:47 -0800 Subject: [PATCH 10/31] Add a Parse cloud example --- cloud/main.js | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/cloud/main.js b/cloud/main.js index 8925fe4cc5..4ce792a3a8 100644 --- a/cloud/main.js +++ b/cloud/main.js @@ -1,4 +1,34 @@ +Parse.Cloud.define('pushChannelTest', function(request, response) { -Parse.Cloud.define('hello', function(req, res) { - res.success('Hi'); + // request has 2 parameters: params passed by the client and the authorized user + var params = request.params; + var user = request.user; + + // extract out the channel to send + var action = params.action; + var message = params.message; + var customData = params.customData; + + // use to custom tweak whatever payload you wish to send + var pushQuery = new Parse.Query(Parse.Installation); + pushQuery.equalTo("deviceType", "android"); + + var payload = {"data": { + "alert": message, + "action": action, + "customdata": customData} + }; + + // Note that useMasterKey is necessary for Push notifications to succeed. + + Parse.Push.send({ + where: pushQuery, // for sending to a specific channel + data: payload, + }, { success: function() { + console.log("#### PUSH OK"); + }, error: function(error) { + console.log("#### PUSH ERROR" + error.message); + }, useMasterKey: true}); + + response.success('success'); }); From f040e27dfe6aebf22fcfb12e15a6a3932090d1ef Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Wed, 2 Mar 2016 22:52:37 -0800 Subject: [PATCH 11/31] Killing clientKey --- index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/index.js b/index.js index 250be154b9..f2b11fad6e 100644 --- a/index.js +++ b/index.js @@ -33,7 +33,6 @@ var api = new ParseServer({ cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js', appId: process.env.APP_ID || 'myAppId', masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it secret! - clientKey: process.env.CLIENT_KEY || 'clientKey', javascriptKey: process.env.JAVASCRIPT_KEY || 'javascriptKey', push: pushConfig, filesAdapter: filesAdapter, From 14fabac15d6ae96d6184aae9daa37d1a3d126d42 Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Thu, 3 Mar 2016 00:03:42 -0800 Subject: [PATCH 12/31] If any of these keys exist, Parse server will 404. --- index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/index.js b/index.js index f2b11fad6e..08fec1dfc8 100644 --- a/index.js +++ b/index.js @@ -33,7 +33,6 @@ var api = new ParseServer({ cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js', appId: process.env.APP_ID || 'myAppId', masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it secret! - javascriptKey: process.env.JAVASCRIPT_KEY || 'javascriptKey', push: pushConfig, filesAdapter: filesAdapter, serverURL: process.env.SERVER_URL || 'http://localhost/parse' // needed for Parse Cloud and push notifications From 754195113713d0ea0a4d88bf502787d0c4b98aca Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Thu, 3 Mar 2016 01:10:03 -0800 Subject: [PATCH 13/31] Update index.js --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 08fec1dfc8..0b8dda65cf 100644 --- a/index.js +++ b/index.js @@ -12,7 +12,7 @@ if (!databaseUri) { var pushConfig = {}; -if (process.env.GCM_ENABLE) { +if (process.env.GCM_SENDER_ID && process.env.GCM_API_KEY) { pushConfig['android'] = { senderId: process.env.GCM_SENDER_ID || '', apiKey: process.env.GCM_API_KEY || ''}; } From 78d5d26aefa44a64b18197f116cf1308a6986704 Mon Sep 17 00:00:00 2001 From: Nathan Esquenazi Date: Thu, 3 Mar 2016 19:48:44 -0800 Subject: [PATCH 14/31] Update main.js --- cloud/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud/main.js b/cloud/main.js index 4ce792a3a8..19be4dc2ae 100644 --- a/cloud/main.js +++ b/cloud/main.js @@ -17,7 +17,7 @@ Parse.Cloud.define('pushChannelTest', function(request, response) { "alert": message, "action": action, "customdata": customData} - }; + }; // Note that useMasterKey is necessary for Push notifications to succeed. From f7dc94e06cb73db40caf9884cea8854a5b3f9053 Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Fri, 4 Mar 2016 00:20:37 -0800 Subject: [PATCH 15/31] Update example to reflect ParseNotificationExample --- cloud/main.js | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/cloud/main.js b/cloud/main.js index 19be4dc2ae..fd8457aa57 100644 --- a/cloud/main.js +++ b/cloud/main.js @@ -4,20 +4,28 @@ Parse.Cloud.define('pushChannelTest', function(request, response) { var params = request.params; var user = request.user; - // extract out the channel to send - var action = params.action; - var message = params.message; + // To be used with: + // https://github.com/codepath/ParsePushNotificationExample + // See https://github.com/codepath/ParsePushNotificationExample/blob/master/app/src/main/java/com/test/MyCustomReceiver.java var customData = params.customData; + var launch = params.launch; + var broadcast = params.broadcast; // use to custom tweak whatever payload you wish to send var pushQuery = new Parse.Query(Parse.Installation); pushQuery.equalTo("deviceType", "android"); - var payload = {"data": { - "alert": message, - "action": action, - "customdata": customData} - }; + var payload = {}; + + if (customData) { + payload.customdata = customData; + } + else if (launch) { + payload.launch = launch; + } + else if (broadcast) { + payload.broadcast = broadcast; + } // Note that useMasterKey is necessary for Push notifications to succeed. From dd7585e59f3102a7e61040dd35fb764f1d670b3f Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Tue, 15 Mar 2016 00:47:28 -0700 Subject: [PATCH 16/31] Parse bunch Bump to new version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 949e634418..2315b1848b 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "express": "~4.2.x", "kerberos": "~0.0.x", "parse": "~1.6.12", - "parse-server": "~2.0" + "parse-server": "~2.1.6" }, "scripts": { "start": "node index.js" From cde64a93fe7d3ecf3dbbb29bfb085dda7423073a Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Wed, 16 Mar 2016 00:24:19 -0700 Subject: [PATCH 17/31] Add APNS example code too. --- index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/index.js b/index.js index 0b8dda65cf..92bbee44a5 100644 --- a/index.js +++ b/index.js @@ -17,6 +17,17 @@ if (process.env.GCM_SENDER_ID && process.env.GCM_API_KEY) { apiKey: process.env.GCM_API_KEY || ''}; } +if (process.env.APNS_ENABLE) { + pushConfig['ios'] = [ + { + pfx: 'ParsePushDevelopmentCertificate.p12', // P12 file only + bundleId: 'beta.codepath.parsetesting', // change to match bundleId + production: false // dev certificate + } + ] +} + + var filesAdapter = null; // enable Gridstore to be the default if (process.env.S3_ENABLE) { var S3Adapter = require('parse-server').S3Adapter; From 436c2926f079bb83c6c69c47d1bd62d1ff4c0ed2 Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Wed, 16 Mar 2016 01:07:21 -0700 Subject: [PATCH 18/31] Add simple example for iOS push --- cloud/main.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/cloud/main.js b/cloud/main.js index fd8457aa57..cd8080a534 100644 --- a/cloud/main.js +++ b/cloud/main.js @@ -40,3 +40,30 @@ Parse.Cloud.define('pushChannelTest', function(request, response) { response.success('success'); }); + +Parse.Cloud.define("iosPushTest", function(request, response) { + + // request has 2 parameters: params passed by the client and the authorized user + var params = request.params; + var user = request.user; + + // Our "Message" class has a "text" key with the body of the message itself + var messageText = params.text; + + var pushQuery = new Parse.Query(Parse.Installation); + pushQuery.equalTo('deviceType', 'ios'); // targeting iOS devices only + + Parse.Push.send({ + where: pushQuery, // Set our Installation query + data: { + alert: "Message: " + messageText + } + }, { success: function() { + console.log("#### PUSH OK"); + }, error: function(error) { + console.log("#### PUSH ERROR" + error.message); + }, useMasterKey: true}); + + response.success('success'); +}); + From 154f4f00499eb107a333a9e35bcece934f63a95c Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Wed, 16 Mar 2016 01:08:11 -0700 Subject: [PATCH 19/31] Update main.js --- cloud/main.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cloud/main.js b/cloud/main.js index cd8080a534..0b2850f622 100644 --- a/cloud/main.js +++ b/cloud/main.js @@ -1,3 +1,4 @@ +// Android push test Parse.Cloud.define('pushChannelTest', function(request, response) { // request has 2 parameters: params passed by the client and the authorized user @@ -41,6 +42,7 @@ Parse.Cloud.define('pushChannelTest', function(request, response) { response.success('success'); }); +// iOS push testing Parse.Cloud.define("iosPushTest", function(request, response) { // request has 2 parameters: params passed by the client and the authorized user From 641c7bab78c96e31054dae1f7dce1df510610952 Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Mon, 21 Mar 2016 15:37:03 -0700 Subject: [PATCH 20/31] Update package.json Move to support live queries --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2315b1848b..332c7463db 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "express": "~4.2.x", "kerberos": "~0.0.x", "parse": "~1.6.12", - "parse-server": "~2.1.6" + "parse-server": "~2.2.0" }, "scripts": { "start": "node index.js" From 57115ad441dc648fed1d1c9d54e8d0e8d231a411 Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Tue, 1 Nov 2016 00:00:27 -0700 Subject: [PATCH 21/31] Update package.json --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 332c7463db..1518760022 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "parse-server-example", - "version": "1.0.0", + "version": "1.4.0", "description": "An example Parse API server using the parse-server module", "main": "index.js", "repository": { @@ -9,15 +9,15 @@ }, "license": "MIT", "dependencies": { - "express": "~4.2.x", + "express": "~4.11.x", "kerberos": "~0.0.x", - "parse": "~1.6.12", - "parse-server": "~2.2.0" + "parse": "~1.8.0", + "parse-server": "*" }, "scripts": { "start": "node index.js" }, "engines": { - "node": ">=4.1" + "node": ">=4.3" } } From cf6566561b4b774e74c69c8c4ac8259129b95862 Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Tue, 1 Nov 2016 00:04:26 -0700 Subject: [PATCH 22/31] Update index.js --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 92bbee44a5..93c28584dc 100644 --- a/index.js +++ b/index.js @@ -60,7 +60,7 @@ app.use(mountPath, api); // Parse Server plays nicely with the rest of your web routes app.get('/', function(req, res) { - res.status(200).send('I dream of being a web site.'); + res.status(200).send('I dream of being a website. Please star the parse-server repo on GitHub!'); }); var port = process.env.PORT || 1337; From e52a606cfc487dad7b5008c9883d11cb92dc2312 Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Mon, 7 Nov 2016 00:15:25 -0800 Subject: [PATCH 23/31] Update to MONGODB_URI --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 93c28584dc..f35572d02b 100644 --- a/index.js +++ b/index.js @@ -4,7 +4,7 @@ var express = require('express'); var ParseServer = require('parse-server').ParseServer; -var databaseUri = process.env.DATABASE_URI || process.env.MONGOLAB_URI +var databaseUri = process.env.DATABASE_URI || process.env.MONGODB_URI; if (!databaseUri) { console.log('DATABASE_URI not specified, falling back to localhost.'); From b925bb7305a52b523e42d734973a47c33f95fefa Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Mon, 7 Nov 2016 00:10:32 -0800 Subject: [PATCH 24/31] Update app.json --- app.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app.json b/app.json index a4b9a67dc3..022859b272 100644 --- a/app.json +++ b/app.json @@ -16,6 +16,10 @@ "MASTER_KEY": { "description": "A key that overrides all permissions. Keep this secret.", "value": "myMasterKey" + }, + "SERVER_URL": { + "description": "URL to connect to your Heroku instance (update with your app's name + PARSE_MOUNT)", + "value": "http://yourappname.herokuapp.com/parse" } }, "image": "heroku/nodejs", From 6d58844277e638a4bae594ee08ae20d02c71938d Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Fri, 24 Mar 2017 01:23:14 -0700 Subject: [PATCH 25/31] Add LiveQuery support --- index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index f35572d02b..76d6c73090 100644 --- a/index.js +++ b/index.js @@ -3,6 +3,7 @@ var express = require('express'); var ParseServer = require('parse-server').ParseServer; +var path = require('path'); var databaseUri = process.env.DATABASE_URI || process.env.MONGODB_URI; @@ -46,6 +47,7 @@ var api = new ParseServer({ masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it secret! push: pushConfig, filesAdapter: filesAdapter, + liveQuery: { classNames: ["Message"]}, serverURL: process.env.SERVER_URL || 'http://localhost/parse' // needed for Parse Cloud and push notifications }); // Client-keys like the javascript key or the .NET key are not necessary with parse-server @@ -54,6 +56,9 @@ var api = new ParseServer({ var app = express(); +// Serve static assets from the /public folder +app.use('/public', express.static(path.join(__dirname, '/public'))); + // Serve the Parse API on the /parse URL prefix var mountPath = process.env.PARSE_MOUNT || '/parse'; app.use(mountPath, api); @@ -64,6 +69,10 @@ app.get('/', function(req, res) { }); var port = process.env.PORT || 1337; -app.listen(port, function() { +var httpServer = require('http').createServer(app); +httpServer.listen(port, function() { console.log('parse-server-example running on port ' + port + '.'); }); + +// This will enable the Live Query real-time server +ParseServer.createLiveQueryServer(httpServer); From 23d7d09df8187ee388ebe8d8b6a492d73419e0bd Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Tue, 4 Apr 2017 22:25:03 -0700 Subject: [PATCH 26/31] Update main.js --- cloud/main.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cloud/main.js b/cloud/main.js index 0b2850f622..4d2afb8266 100644 --- a/cloud/main.js +++ b/cloud/main.js @@ -1,13 +1,14 @@ // Android push test +// To be used with: +// https://github.com/codepath/ParsePushNotificationExample +// See https://github.com/codepath/ParsePushNotificationExample/blob/master/app/src/main/java/com/test/MyCustomReceiver.java + Parse.Cloud.define('pushChannelTest', function(request, response) { // request has 2 parameters: params passed by the client and the authorized user var params = request.params; var user = request.user; - // To be used with: - // https://github.com/codepath/ParsePushNotificationExample - // See https://github.com/codepath/ParsePushNotificationExample/blob/master/app/src/main/java/com/test/MyCustomReceiver.java var customData = params.customData; var launch = params.launch; var broadcast = params.broadcast; From 7fcab8d57f77de0fc5b9649fc93639a20958107f Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Sun, 6 May 2018 11:42:30 -0700 Subject: [PATCH 27/31] Use GCM API key instead --- index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 76d6c73090..7212ee313f 100644 --- a/index.js +++ b/index.js @@ -13,9 +13,8 @@ if (!databaseUri) { var pushConfig = {}; -if (process.env.GCM_SENDER_ID && process.env.GCM_API_KEY) { - pushConfig['android'] = { senderId: process.env.GCM_SENDER_ID || '', - apiKey: process.env.GCM_API_KEY || ''}; +if (process.env.GCM_API_KEY) { + pushConfig['android'] = { apiKey: process.env.GCM_API_KEY || ''}; } if (process.env.APNS_ENABLE) { From 537c0375ccbd94fc6c76895a710c23ec3d63606d Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Sun, 6 May 2018 11:43:02 -0700 Subject: [PATCH 28/31] Rename to FCM --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 7212ee313f..2d3fd827e9 100644 --- a/index.js +++ b/index.js @@ -13,8 +13,8 @@ if (!databaseUri) { var pushConfig = {}; -if (process.env.GCM_API_KEY) { - pushConfig['android'] = { apiKey: process.env.GCM_API_KEY || ''}; +if (process.env.FCM_API_KEY) { + pushConfig['android'] = { apiKey: process.env.FCM_API_KEY || ''}; } if (process.env.APNS_ENABLE) { From 83817e13971ee0e678e2465fee0eade7951d8ff4 Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Tue, 24 Mar 2020 00:10:53 -0700 Subject: [PATCH 29/31] bump versions --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1518760022..881019d7c5 100644 --- a/package.json +++ b/package.json @@ -11,13 +11,13 @@ "dependencies": { "express": "~4.11.x", "kerberos": "~0.0.x", - "parse": "~1.8.0", + "parse": "~2.11.0", "parse-server": "*" }, "scripts": { "start": "node index.js" }, "engines": { - "node": ">=4.3" + "node": ">=8" } } From b3d1f71321c9f79d4c5fd9bb2be90a07cf59e3dc Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Tue, 24 Mar 2020 00:19:19 -0700 Subject: [PATCH 30/31] update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 85fa56c41d..8a15e2e4ad 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Read the full server guide here: https://parse.com/docs/server/guide ### For Local Development -* Make sure you have at least Node 4.1. `node --version` +* Make sure you have at least Node 8.0. `node --version` * Clone this repo and change directory to it. * `npm install` * Install mongo locally using http://docs.mongodb.org/master/tutorial/install-mongodb-on-os-x/ From 000fe00f662c6ba87b0ab6a00b39bb983516f306 Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Wed, 25 Mar 2020 06:27:57 -0700 Subject: [PATCH 31/31] add public server URL and tie to SERVER_URL --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index 2d3fd827e9..06a741201f 100644 --- a/index.js +++ b/index.js @@ -47,6 +47,7 @@ var api = new ParseServer({ push: pushConfig, filesAdapter: filesAdapter, liveQuery: { classNames: ["Message"]}, + publicServerURL: process.env.SERVER_URL || 'http://localhost/parse', serverURL: process.env.SERVER_URL || 'http://localhost/parse' // needed for Parse Cloud and push notifications }); // Client-keys like the javascript key or the .NET key are not necessary with parse-server