Apollo Engine Example
See original GitHub issueI run into this issue regarding the Example with Apollo Engine - (Because I install the lastest version of Apollo Engine) "apollo-engine": "^1.1.0",
throw new Error(`As of apollo-engine 1.x, the Engine class has been replaced with a simpler API. See https://www.apollographql.com/docs/engine/1.0-migration.html to learn how to migrate.`);
So I tried and come up with this solution
require('dotenv').config()
const { GraphQLServer } = require('graphql-yoga')
const { ApolloEngine } = require('apollo-engine')
const compression = require('compression')
const typeDefs = `
type Query {
hello(name: String): String!
}`
const resolvers = {
Query: {
hello: (_, { name }) => `Hello ${name || 'World'}`,
},
}
const server = new GraphQLServer({ typeDefs, resolvers })
// Enable gzip compression
// ref: https://www.apollographql.com/docs/engine/setup-node.html#enabling-compression
server.express.use(compression())
const engine = new ApolloEngine({
apiKey: process.env.APOLLO_ENGINE_API
});
// Instead of app.listen():
engine.listen({
port: 4004,
graphqlPaths: ['/'],
expressApp: server.express,
launcherOptions: {
startupTimeout: 3000,
},
}, () => {
console.log('Apollo Engine Listening!');
});
server.start({
tracing: true,
cacheControl: true,
port: parseInt(process.env.Port, 10) || 4000
}, () => console.log('GraphQL Server Server is running on localhost:4000'))
It is working now.
But I am not sure if this is an optimal solution. Can someon gives me a hint.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Apollo Graph Platform
A complete system to build, manage, and access a graph · A single map of all your data and services · Easy to...
Read more >apollo-engine examples - CodeSandbox
Apollo Engine Examples. Learn how to use apollo-engine by viewing and forking example apps that make use of apollo-engine on CodeSandbox.
Read more >Optimizing GraphQL with Apollo Engine [Tutorial] - Packt Hub
In this article, we will start off with setting up Apollo Engine. Further, we will learn how to analyze schemas, check how our...
Read more >A complete introduction to Apollo, the GraphQL toolkit
Apollo is a suite of tools to create a GraphQL server, and to consume a GraphQL API. Let's explore Apollo in detail, both...
Read more >GitHub - apollographql/apollo-tooling
Tooling for development and production Apollo workflows - GitHub ... Set "tsFileExtension" to specify a different file extension, for example "d.ts" ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@kachkaev it was not with the upgraded version. In fact I am seing it after you mention it. it seems I clone the repo just before the merge was made
Hey 👋, It seems like this issue has been inactive for some time. In need for maintaining clear overview of the issues concerning the latest version of
graphql-yoga
we’ll close it. Feel free to reopen it at any time if you believe we should futher discuss its content. 🙂