Merge pull request #145 from taylorstine/cloud_function
Added cloud funciton argument
This commit is contained in:
13
index.js
13
index.js
@@ -24,7 +24,9 @@ addParseCloud();
|
|||||||
// and delete
|
// and delete
|
||||||
// "databaseURI": a uri like mongodb://localhost:27017/dbname to tell us
|
// "databaseURI": a uri like mongodb://localhost:27017/dbname to tell us
|
||||||
// what database this Parse API connects to.
|
// 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
|
// "appId": the application id to host
|
||||||
// "masterKey": the master key for requests to this app
|
// "masterKey": the master key for requests to this app
|
||||||
// "facebookAppIds": an array of valid Facebook Application IDs, required
|
// "facebookAppIds": an array of valid Facebook Application IDs, required
|
||||||
@@ -52,7 +54,14 @@ function ParseServer(args) {
|
|||||||
}
|
}
|
||||||
if (args.cloud) {
|
if (args.cloud) {
|
||||||
addParseCloud();
|
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] = {
|
cache.apps[args.appId] = {
|
||||||
|
|||||||
Reference in New Issue
Block a user