Skip to Content

WunderGraph Hooks Overview

Published: October 19, 2021

WunderGraph Hooks are an essential part to customize the Request Lifecycle of WunderGraph Applications.

In this section, you'll learn what Hooks are meant for and how to use them.

The Request Hooks LifeCycle#

  1. Request Handler begins
  2. Input Parsing
  3. JSON Schema Input Validation
  4. Claims Injection
  5. preResolveHook
  6. mutatingPreResolveHook
  7. resolver
  8. postResolveHook
  9. mutatingPostResolveHook
  10. Sending Response to Client

Available Hooks#

Hooks are available in two categories. Mutating Hooks and non-Mutating Hooks.

Mutating Hooks, as the name suggests, directly influence the Request Chain. They can manipulate the inputs to an Operation or the response.

Non-Mutating Hooks on the other side simply receive the data currently available to the request chain, e.g. the user Object, inputs or a response.

Use Cases#

With non-Mutating Hooks, you're able to log specific events or invoke side effects, e.g. sending an Email after a mutation.

Mutating Hooks on the other hand are designed to react to the inputs, or the resolved response, based on the Request Context. E.g. you could define custom hook variables for filtering or use information about the user to filter or manipulate responses.


Product

Subscribe to our newsletter!

Stay informed when great things happen! Get the latest news about APIs, GraphQL and more straight into your mailbox.

© 2021 WunderGraph