Skip to content

Commit

Permalink
Merge pull request #168 from fabien0102/feature/apollo-engine-example
Browse files Browse the repository at this point in the history
Feature/apollo engine example
  • Loading branch information
schickling authored Feb 14, 2018
2 parents 01701de + 7412740 commit 2234c88
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions examples/apollo-engine/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const { GraphQLServer } = require('graphql-yoga')
const { Engine } = require('apollo-engine')
const compression = require('compression')

const typeDefs = `
type Query {
Expand All @@ -19,8 +20,14 @@ const engine = new Engine({
endpoint: '/',
graphqlPort: parseInt(process.env.Port, 10) || 4000,
})
engine.start();
engine.start()

// Enable gzip compression
// ref: https://www.apollographql.com/docs/engine/setup-node.html#enabling-compression
server.express.use(compression())
server.express.use(engine.expressMiddleware())

server.start(() => console.log('Server is running on localhost:4000'))
server.start({
tracing: true,
cacheControl: true
}, () => console.log('Server is running on localhost:4000'))
1 change: 1 addition & 0 deletions examples/apollo-engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
},
"dependencies": {
"apollo-engine": "0.8.5",
"compression": "1.7.1",
"graphql-yoga": "1.2.0"
}
}

0 comments on commit 2234c88

Please sign in to comment.