graphql yoga access http headers

JavaScript
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'))
Source

Also in JavaScript: