-
Notifications
You must be signed in to change notification settings - Fork 7
Hooks
Davide Gheri edited this page Feb 23, 2021
·
1 revision
Mercurius expose few hooks allowing you to listen to specific events in the GraphQL request/response lifecycle.
Hooks are registered as method decorated with the @GraphQLHook(hookName: string)
decorator, for a list of all available hooks, please see Mercurius documentation
import { GraphQLHook } from 'nestjs-mercurius';
@Injectable()
export class HookService {
@GraphQLHook('preValidation')
async onPreValidation(schema: GraphQLSchema, source: DocumentNode, context: any) {
//...
}
}