Created
October 19, 2018 08:43
-
-
Save kirkness/5b4980d12d1463833ed6e6d052ca971a to your computer and use it in GitHub Desktop.
Example of problem where data is not reporting
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
const server = new ApolloServer({ | |
formatError, | |
resolvers, | |
typeDefs: SCHEMA, | |
engine: false, | |
tracing: true, | |
cacheControl: true, | |
subscriptions: { | |
onConnect: authSubscription | |
}, | |
schemaDirectives: { | |
authenticate: AuthenticateDirective, | |
authenticateAdmin: AuthenticateAdminDirective | |
} | |
}); | |
const app = express(); | |
app.use(authMiddleware); | |
server.applyMiddleware({ | |
app, | |
path: '/' | |
}); | |
const startCallback = () => { | |
console.info(`Server started`); | |
}; | |
if (process.env.APOLLO_ENGINE_KEY) { | |
const engine = new ApolloEngine({ | |
apiKey: process.env.APOLLO_ENGINE_KEY, | |
frontends: [ | |
{ | |
overrideGraphqlResponseHeaders: { | |
'Access-Control-Allow-Origin': '*' | |
} | |
} | |
] | |
}); | |
engine.listen({ port, expressApp: app }, startCallback); | |
} else { | |
app.listen({ port }, startCallback); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment