Skip to content

Instantly share code, notes, and snippets.

@maticzav
Created May 31, 2018 08:57
Show Gist options
  • Save maticzav/33e841ec232a10fd45b88ccdb5f4384c to your computer and use it in GitHub Desktop.
Save maticzav/33e841ec232a10fd45b88ccdb5f4384c to your computer and use it in GitHub Desktop.
// Standalone
import { applyMiddleware } from 'graphql-middleware'
const schemaWithMiddleware = applyMiddleware(
schema,
metricsMiddleware,
authMiddleware,
beepMiddleware,
)
// using GraphQL Yoga
import { GraphQLServer } from 'graphql-yoga'
const server = new GraphQLServer({
typeDefs,
resolvers,
middlewares: [authMiddleware, metricsMiddleware]
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment