Apollo
Apollo Server is an open-source, spec-compliant GraphQL server that's compatible with any GraphQL client, including Apollo Client.
It's the best way to build a production-ready, self-documenting GraphQL API that can use data from any source.
Installation
npm install graphql @apollo/server @gqloom/core
Usage
import { weave } from "@gqloom/core"
import { ApolloServer } from "@apollo/server"
import { startStandaloneServer } from "@apollo/server/standalone"
import { HelloResolver } from "./resolvers"
const schema = weave(HelloResolver)
const server = new ApolloServer({ schema })
startStandaloneServer(server, {
listen: { port: 4000 },
}).then(({ url }) => {
console.info(`🚀 Server ready at: ${url}`)
})
Context
The default context for Apollo Server
is an empty object, you need to pass the context to the resolvers manually.
See the Apollo Server documentation for more information.