Apollo-server base file for tutorial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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