File tree Expand file tree Collapse file tree 4 files changed +56
-7
lines changed Expand file tree Collapse file tree 4 files changed +56
-7
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,18 @@ class ParseGraphQLServer {
76
76
renderPlaygroundPage ( {
77
77
endpoint : this . config . graphQLPath ,
78
78
subscriptionEndpoint : this . config . subscriptionsPath ,
79
+ tabs : [
80
+ {
81
+ endpoint : this . config . graphQLPath ,
82
+ query : `query {
83
+ health
84
+ }` ,
85
+ headers : {
86
+ 'X-Parse-Application-Id' : this . parseServer . config . appId ,
87
+ 'X-Parse-Master-Key' : this . parseServer . config . masterKey ,
88
+ } ,
89
+ } ,
90
+ ] ,
79
91
} )
80
92
) ;
81
93
res . end ( ) ;
Original file line number Diff line number Diff line change @@ -365,7 +365,7 @@ module.exports.ParseServerOptions = {
365
365
} ,
366
366
mountPlayground : {
367
367
env : 'PARSE_SERVER_MOUNT_PLAYGROUND' ,
368
- help : 'Mounts the GraphQL Playground' ,
368
+ help : 'Mounts the GraphQL Playground. Never use this option in production. ' ,
369
369
action : parsers . booleanParser ,
370
370
default : false ,
371
371
} ,
Original file line number Diff line number Diff line change @@ -34,9 +34,10 @@ import { UsersRouter } from './Routers/UsersRouter';
34
34
import { PurgeRouter } from './Routers/PurgeRouter' ;
35
35
import { AudiencesRouter } from './Routers/AudiencesRouter' ;
36
36
import { AggregateRouter } from './Routers/AggregateRouter' ;
37
-
38
37
import { ParseServerRESTController } from './ParseServerRESTController' ;
39
38
import * as controllers from './Controllers' ;
39
+ import { ParseGraphQLServer } from './GraphQL/ParseGraphQLServer' ;
40
+
40
41
// Mutate the Parse object to add the Cloud Code handlers
41
42
addParseCloud ( ) ;
42
43
@@ -264,6 +265,22 @@ class ParseServer {
264
265
}
265
266
266
267
app . use ( options . mountPath , this . app ) ;
268
+
269
+ if ( options . mountGraphQL === true || options . mountPlayground === true ) {
270
+ const parseGraphQLServer = new ParseGraphQLServer ( this , {
271
+ graphQLPath : options . graphQLPath ,
272
+ playgroundPath : options . playgroundPath ,
273
+ } ) ;
274
+
275
+ if ( options . mountGraphQL ) {
276
+ parseGraphQLServer . applyGraphQL ( app ) ;
277
+ }
278
+
279
+ if ( options . mountPlayground ) {
280
+ parseGraphQLServer . applyPlayground ( app ) ;
281
+ }
282
+ }
283
+
267
284
const server = app . listen ( options . port , options . host , callback ) ;
268
285
this . server = server ;
269
286
Original file line number Diff line number Diff line change @@ -84,19 +84,39 @@ runner({
84
84
} ) ;
85
85
} else {
86
86
ParseServer . start ( options , ( ) => {
87
- console . log (
88
- '[' + process . pid + '] parse-server running on ' + options . serverURL
89
- ) ;
87
+ printSuccessMessage ( ) ;
90
88
} ) ;
91
89
}
92
90
} else {
93
91
ParseServer . start ( options , ( ) => {
94
92
logOptions ( ) ;
95
93
console . log ( '' ) ;
94
+ printSuccessMessage ( ) ;
95
+ } ) ;
96
+ }
97
+
98
+ function printSuccessMessage ( ) {
99
+ console . log (
100
+ '[' + process . pid + '] parse-server running on ' + options . serverURL
101
+ ) ;
102
+ if ( options . mountGraphQL ) {
96
103
console . log (
97
- '[' + process . pid + '] parse-server running on ' + options . serverURL
104
+ '[' +
105
+ process . pid +
106
+ '] GraphQL running on http://localhost:' +
107
+ options . port +
108
+ options . graphQLPath
98
109
) ;
99
- } ) ;
110
+ }
111
+ if ( options . mountPlayground ) {
112
+ console . log (
113
+ '[' +
114
+ process . pid +
115
+ '] Playground running on http://localhost:' +
116
+ options . port +
117
+ options . playgroundPath
118
+ ) ;
119
+ }
100
120
}
101
121
} ,
102
122
} ) ;
You can’t perform that action at this time.
0 commit comments