GraphQL support via cli (#5697)

* Including GraphQL options in CLI - now it was auto-generated

* Improving the way that the headers are passed to the playground

* Including README notes about GraphQL

* Improving final text
This commit is contained in:
Antonio Davi Macedo Coelho de Castro
2019-06-25 14:44:23 -07:00
committed by GitHub
parent 7ffb3b65e0
commit 5bc79cc3db
8 changed files with 315 additions and 7 deletions

View File

@@ -34,9 +34,10 @@ import { UsersRouter } from './Routers/UsersRouter';
import { PurgeRouter } from './Routers/PurgeRouter';
import { AudiencesRouter } from './Routers/AudiencesRouter';
import { AggregateRouter } from './Routers/AggregateRouter';
import { ParseServerRESTController } from './ParseServerRESTController';
import * as controllers from './Controllers';
import { ParseGraphQLServer } from './GraphQL/ParseGraphQLServer';
// Mutate the Parse object to add the Cloud Code handlers
addParseCloud();
@@ -264,6 +265,22 @@ class ParseServer {
}
app.use(options.mountPath, this.app);
if (options.mountGraphQL === true || options.mountPlayground === true) {
const parseGraphQLServer = new ParseGraphQLServer(this, {
graphQLPath: options.graphQLPath,
playgroundPath: options.playgroundPath,
});
if (options.mountGraphQL) {
parseGraphQLServer.applyGraphQL(app);
}
if (options.mountPlayground) {
parseGraphQLServer.applyPlayground(app);
}
}
const server = app.listen(options.port, options.host, callback);
this.server = server;