Skip to content

Instantly share code, notes, and snippets.

@bengrunfeld
Last active June 2, 2021 13:51
Show Gist options
  • Save bengrunfeld/f864cfb1dcf8deb1a22e4853f2e2d9b0 to your computer and use it in GitHub Desktop.
Save bengrunfeld/f864cfb1dcf8deb1a22e4853f2e2d9b0 to your computer and use it in GitHub Desktop.
GraphQL Express Server
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