Last active
June 2, 2021 13:51
-
-
Save bengrunfeld/f864cfb1dcf8deb1a22e4853f2e2d9b0 to your computer and use it in GitHub Desktop.
GraphQL Express Server
This file contains hidden or 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 express from 'express' | |
import { ApolloServer } from 'apollo-server-express' | |
import { typeDefs, resolvers } from '../graphql' | |
const server = new ApolloServer({ | |
typeDefs, | |
resolvers, | |
introspection: true, | |
playground: true | |
}) | |
const app = express() | |
server.applyMiddleware({ app }) | |
app.listen({ post: 4000}, () => | |
console.log(`Server ready at http://localhost:4000${server.graphqlPath}`) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment