How to use the apollo-server-micro.microGraphiql function in apollo-server-micro

To help you get started, we’ve selected a few apollo-server-micro examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MainframeHQ / onyx / server / graphql / server.js View on Github external
export default (pss: PSS, port: number) => {
  const schema = createSchema(pss, port)
  const graphqlHandler = microGraphql({ schema })
  const graphiqlHandler = microGraphiql({ endpointURL: '/graphql' })

  return {
    routes: [
      get('/graphql', graphqlHandler),
      post('/graphql', graphqlHandler),
      get('/graphiql', graphiqlHandler),
    ],
    onCreated: (server: Server) => {
      SubscriptionServer.create(
        { execute, schema, subscribe },
        { path: '/graphql', server },
      )
    },
  }
}