Last active
March 12, 2018 15:13
-
-
Save stubailo/6195d39b3f10500326d62aa1bc2aab0b to your computer and use it in GitHub Desktop.
Engine setup with Apollo Server
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
// Install and import the apollo-engine package | |
const { ApolloEngine } = require('apollo-engine'); | |
const { graphqlExpress } = require('apollo-server-express'); | |
const app = express(); | |
// Enable tracing and cacheControl in Apollo Server | |
app.use('/graphql', graphqlExpress({ | |
tracing: true, | |
cacheControl: true, | |
schema: schema, | |
// ... other options | |
}); | |
// Initialize Engine with an API key | |
const engine = new ApolloEngine({ apiKey: 'API_KEY' }); | |
// Replace app.listen() with engine.listen() | |
engine.listen({ | |
port: 3000, | |
expressApp: app, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment