Class GraphQLController
java.lang.Object
io.micronaut.configuration.graphql.GraphQLController
The GraphQL controller handling GraphQL requests.
- Since:
- 1.0
- Author:
- Marcel Overdijk, James Kleeh, Alexey Zhokhov
-
Constructor Summary
ConstructorDescriptionGraphQLController
(GraphQLInvocation graphQLInvocation, GraphQLExecutionResultHandler graphQLExecutionResultHandler, GraphQLJsonSerializer graphQLJsonSerializer) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionorg.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<String>>
get
(String query, @Nullable String operationName, @Nullable String variables, io.micronaut.http.HttpRequest httpRequest) Handles GraphQLGET
requests.org.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<String>>
post
(@Nullable String query, @Nullable String operationName, @Nullable String variables, @Nullable String body, io.micronaut.http.HttpRequest httpRequest) Handles GraphQLPOST
requests.
-
Constructor Details
-
GraphQLController
public GraphQLController(GraphQLInvocation graphQLInvocation, GraphQLExecutionResultHandler graphQLExecutionResultHandler, GraphQLJsonSerializer graphQLJsonSerializer) Default constructor.- Parameters:
graphQLInvocation
- theGraphQLInvocation
instancegraphQLExecutionResultHandler
- theGraphQLExecutionResultHandler
instancegraphQLJsonSerializer
- theGraphQLJsonSerializer
instance
-
-
Method Details
-
get
@Get(produces="application/json", single=true) public org.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<String>> get(@QueryValue("query") String query, @Nullable @QueryValue("operationName") @Nullable String operationName, @Nullable @QueryValue("variables") @Nullable String variables, io.micronaut.http.HttpRequest httpRequest) Handles GraphQLGET
requests.- Parameters:
query
- the GraphQL queryoperationName
- the GraphQL operation namevariables
- the GraphQL variableshttpRequest
- the HTTP request- Returns:
- the GraphQL response
-
post
@Post(consumes="*/*", produces="application/json", single=true) public org.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<String>> post(@Nullable @QueryValue("query") @Nullable String query, @Nullable @QueryValue("operationName") @Nullable String operationName, @Nullable @QueryValue("variables") @Nullable String variables, @Nullable @Body @Nullable String body, io.micronaut.http.HttpRequest httpRequest) Handles GraphQLPOST
requests.- Parameters:
query
- the GraphQL queryoperationName
- the GraphQL operation namevariables
- the GraphQL variablesbody
- the GraphQL request bodyhttpRequest
- the HTTP request- Returns:
- the GraphQL response
-