How to use the apollo-server-micro.microGraphql 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.

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 },
      )
    },
  }
}

apollo-server-micro

Production-ready Node.js GraphQL server for Micro

MIT
Latest version published 1 month ago

Package Health Score

92 / 100
Full package analysis

Similar packages