Acesso de ioga grafql cabeçalhos HTTP

import { GraphQLServer } from 'graphql-yoga'
// ... or using `require()`
// const { GraphQLServer } = require('graphql-yoga')

const typeDefs = `
  type Query {
    showHeader(headerName: String): String!
  }
`

const resolvers = {
  Query: {
    showHeader: (_, { headerName }, ctx) => ctx.request.get(headerName),
  },
}

const server = new GraphQLServer({ typeDefs, resolvers, context: req => ({ ...req }) })
server.start(() => console.log('Server is running on localhost:4000'))
Important Iguana