Skip to content

Instantly share code, notes, and snippets.

@DWboutin
Created November 8, 2022 15:28
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Apollo-server base file for tutorial
import { ApolloServer } from '@apollo/server'
import { startStandaloneServer } from '@apollo/server/standalone'
// The GraphQL schema
const typeDefs = `#graphql
type Query {
hello: String
}
`
// A map of functions which return data for the schema.
const resolvers = {
Query: {
hello: () => 'world',
},
}
const server = new ApolloServer({
typeDefs,
resolvers,
})
const startServer = async () => {
const { url } = await startStandaloneServer(server)
console.log(`🚀 Server ready at ${url}`)
}
startServer()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment