Skip to content
GQLoom

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

sh
npm i graphql @apollo/server @gqloom/core
sh
pnpm add graphql @apollo/server @gqloom/core
sh
yarn add graphql @apollo/server @gqloom/core
sh
bun add graphql @apollo/server @gqloom/core

Usage

ts
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.