From 4bda6e49e4e78573a4160542f28f6c260906c0f3 Mon Sep 17 00:00:00 2001 From: Taylor Stine Date: Mon, 1 Feb 2016 15:41:22 -0500 Subject: [PATCH 1/2] Added cloud funciton argument --- index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 79a32198..ae526e19 100644 --- a/index.js +++ b/index.js @@ -51,7 +51,14 @@ function ParseServer(args) { } if (args.cloud) { addParseCloud(); - require(args.cloud); + if (typeof args.cloud === 'function') { + args.cloud(Parse) + } else if (typeof args.cloud === 'string') { + require(args.cloud); + } else { + throw "argument 'cloud' must either be a string or a function"; + } + } cache.apps[args.appId] = { From 95cea9230b88feae1f0a6cb51686af7522de0193 Mon Sep 17 00:00:00 2001 From: Taylor Stine Date: Tue, 2 Feb 2016 07:51:19 -0500 Subject: [PATCH 2/2] Added detail comment to the ParseServer constructor for cloud function --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index ae526e19..209110af 100644 --- a/index.js +++ b/index.js @@ -23,7 +23,9 @@ addParseCloud(); // and delete // "databaseURI": a uri like mongodb://localhost:27017/dbname to tell us // what database this Parse API connects to. -// "cloud": relative location to cloud code to require +// "cloud": relative location to cloud code to require, or a function +// that is given an instance of Parse as a parameter. Use this instance of Parse +// to register your cloud code hooks and functions. // "appId": the application id to host // "masterKey": the master key for requests to this app // "facebookAppIds": an array of valid Facebook Application IDs, required