Skip to content

Instantly share code, notes, and snippets.

@kirkness
Created October 19, 2018 08:43
Show Gist options
  • Save kirkness/5b4980d12d1463833ed6e6d052ca971a to your computer and use it in GitHub Desktop.
Save kirkness/5b4980d12d1463833ed6e6d052ca971a to your computer and use it in GitHub Desktop.
Example of problem where data is not reporting
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