const express = require('express'); const { ApolloServer, gql } = require('apollo-server-express'); const { typeDefs, resolvers } = require('./schema'); // https://www.apollographql.com/docs/apollo-server/features/graphql-playground.html#Enabling-GraphQL-Playground-in-production const server = new ApolloServer({ typeDefs, resolvers, introspection: true, playground: { settings: { 'editor.theme': 'light' } } }); // Additional middleware can be mounted at this point to run before Apollo const app = express(); server.applyMiddleware({ app, path: '/somepath' }); // Start the server const port = 8080; app.listen({ port }, () => { console.log(`Liftoff of Apollo Server at http://localhost:${port}${server.graphqlPath}`) });