Skip to main content


GraphQL Controllers act like a resolver, while also defining their schema. You define the operation input which must be a DTO declared inside the same module with the Controller.

It is also necessary to define the operation type of the controller, as a result defining the interaction of the controller with the GraphQL clients.

GraphQLController HelloWorldGQLController () {
operation: GraphQL.Operations.Query;
input: HelloWorldRequestDTO;

execute (request): HelloWorldResponseDTO {
const response = HelloWorldResponseDTO({
message: 'Hello World!'
return this.ok(response);

It is important that you return a value, either success or error, otherwise the operation will fail.

Operation type

GraphQL.Operations.Querya read‐only fetch.
GraphQL.Operations.Mutationa write followed by a fetch.
GraphQL.Operations.Subscriptiona long‐lived request that fetches data in response to source events.

Return values and error-handling

this.ok(DTO)regular response for success
this.clientError(message?: string)UserInputError
this.unauthorized(message?: string)AuthenticationError
this.forbidden(message?: string)ForbiddenError Error | string)ApolloError