Closed bearcanrun closed 8 years ago
Hi! I haven't tried, but think this should work?
https://github.com/apollostack/optics-agent-js/blob/master/README.md
Instrument your schema: OpticsAgent.instrumentSchema(executableSchema);
Add the middleware: expressServer.use(OpticsAgent.middleware());
Add to your GraphQL context object: context.opticsContext = OpticsAgent.context(req);
createApolloServer(req => {
return {
schema: OpticsAgent.instrumentSchema(executableSchema),
context: {
opticsContext: OpticsAgent.context(req)
}
}
}, {
configServer: (expressServer) => {
expressServer.use(OpticsAgent.middleware())
}
})
This works perfect. Thank you! I didn't understand how to integrate the middleware and didn't realize it was so easy.
Hi, it seems this code breaks the meteor context, it should pass context.userId
and context.user
, when I try to reverse changes, context is still undefined. I tried meteor reset, and re-install apollo-server but it does not work
Is there a way to use Apollo Optics with this package, or would we need to integrate Apollo manually to apply OpticsAgent as middleware and set opticsContext?