Recall & Review
beginner
What is a Resolver in NestJS GraphQL?
A Resolver is a special class in NestJS that handles GraphQL queries and mutations. It connects GraphQL requests to the code that fetches or modifies data.Click to reveal answer
beginner
How do you define a Query in a NestJS Resolver?
You use the @Query() decorator on a method inside a Resolver class. This method runs when the GraphQL query with the same name is called.
Click to reveal answer
beginner
What decorator is used to create a Mutation in a NestJS Resolver?
The @Mutation() decorator is used on a method inside a Resolver class to handle GraphQL mutations, which change data.Click to reveal answer
intermediate
Why do Resolvers use dependency injection in NestJS?
Resolvers use dependency injection to get services that handle the actual data logic. This keeps the Resolver focused on GraphQL and clean code separation.
Click to reveal answer
beginner
What is the role of the @Resolver() decorator in NestJS?
The @Resolver() decorator marks a class as a GraphQL Resolver. It can optionally take an object type to link the Resolver to a GraphQL type.Click to reveal answer
Which decorator defines a GraphQL query method in a NestJS Resolver?
✗ Incorrect
The @Query() decorator marks a method as a GraphQL query handler.
What does the @Resolver() decorator do?
✗ Incorrect
The @Resolver() decorator marks a class as a GraphQL Resolver in NestJS.
How do Resolvers get access to services in NestJS?
✗ Incorrect
Resolvers receive services via dependency injection through their constructor.
Which decorator is used to handle data changes in GraphQL with NestJS?
✗ Incorrect
The @Mutation() decorator is used for GraphQL mutations that change data.
What is the main purpose of a Resolver in NestJS GraphQL?
✗ Incorrect
Resolvers connect GraphQL queries and mutations to the code that fetches or changes data.
Explain how to create a simple Query Resolver method in NestJS and what it does.
Think about how a method is marked to respond to a GraphQL query.
You got /4 concepts.
Describe the role of dependency injection in NestJS Resolvers and why it is useful.
Consider how services are provided to Resolvers without manual creation.
You got /4 concepts.