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
ConstructorsConstructorDescriptionGraphQLController(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 GraphQLGETrequests.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 GraphQLPOSTrequests.
-
Constructor Details
-
GraphQLController
public GraphQLController(GraphQLInvocation graphQLInvocation, GraphQLExecutionResultHandler graphQLExecutionResultHandler, GraphQLJsonSerializer graphQLJsonSerializer) Default constructor.- Parameters:
graphQLInvocation- theGraphQLInvocationinstancegraphQLExecutionResultHandler- theGraphQLExecutionResultHandlerinstancegraphQLJsonSerializer- theGraphQLJsonSerializerinstance
-
-
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 GraphQLGETrequests.- 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 GraphQLPOSTrequests.- Parameters:
query- the GraphQL queryoperationName- the GraphQL operation namevariables- the GraphQL variablesbody- the GraphQL request bodyhttpRequest- the HTTP request- Returns:
- the GraphQL response
-