Skip to content

Add extensions function to createHandler #109

Answered by enisdenjo
bryanpyle asked this question in Q&A
Discussion options

You must be logged in to vote

This is already possible with the onOperation handler hook. Roughly:

import { createHandler } from 'graphql-http';
import { schema } from './my-graphql-schema';

const handler = createHandler({
  schema,
  onOperation(_req, _args, result) {
    return {
      ...result,
      extensions: {
        myCustom: 'metadata',
      },
    };
  },
});

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@bryanpyle
Comment options

Answer selected by enisdenjo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #107 on August 16, 2023 09:43.