File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,9 @@ addParseCloud();
2424// and delete
2525// "databaseURI": a uri like mongodb://localhost:27017/dbname to tell us
2626// what database this Parse API connects to.
27- // "cloud": relative location to cloud code to require
27+ // "cloud": relative location to cloud code to require, or a function
28+ // that is given an instance of Parse as a parameter. Use this instance of Parse
29+ // to register your cloud code hooks and functions.
2830// "appId": the application id to host
2931// "masterKey": the master key for requests to this app
3032// "facebookAppIds": an array of valid Facebook Application IDs, required
@@ -52,7 +54,14 @@ function ParseServer(args) {
5254 }
5355 if ( args . cloud ) {
5456 addParseCloud ( ) ;
55- require ( args . cloud ) ;
57+ if ( typeof args . cloud === 'function' ) {
58+ args . cloud ( Parse )
59+ } else if ( typeof args . cloud === 'string' ) {
60+ require ( args . cloud ) ;
61+ } else {
62+ throw "argument 'cloud' must either be a string or a function" ;
63+ }
64+
5665 }
5766
5867 cache . apps [ args . appId ] = {
You can’t perform that action at this time.
0 commit comments