-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optional context should return request by default #159
Comments
@katopz I actually think it's a bad feature of express-graphql that it sets the context to be the request by default. This way it won't be possible to set the context to I think you can just do this for express-graphql?
|
@helfer Cool, so we should open issue to Thanks |
This was a feature added to express to make it possible to conveniently set context via middleware. I don't think Apollo server needs to be exactly the same as express-graphql though right? I kind of enjoy that Apollo server is minimal and makes it really clear exactly what is happening. |
@stubailo Well, it should be docs for the diff in that case :) // `context` must be an object and can't be undefined when using connectors
graphQLServer.use('/graphql', bodyParser.json(), apolloExpress({
schema: executableSchema,
context: req // this shouldn't work? req is undefined?
})); Thanks |
Did we not document that you can pass options as a function? That's definitely something we should fix. @helfer do you know if that works for every server, or just for Express? |
I know it works for express and connect. Koa will use the context, and I'm not sure about Hapi, but I think it works there as well. The request object is somewhat different though. |
…-debug-false Don't enable logging if debug is explicitly false
…-debug-false Don't enable logging if debug is explicitly false
…-debug-false Don't enable logging if debug is explicitly false
Hi guys,
I currently use both
express-graphql
andapollo-server
by sharing executable schema, so far so good but suddenly hit some different here.Refer to
express-graphql
: https://github.com/graphql/express-graphql/blob/bdd7a954aff7621bb338d722b44371f7643c2258/src/index.js#L133But
apollo-server
: https://github.com/apollostack/apollo-server/blob/f4546e7654a2b12bb77ef5af407d89d1a62e8d6d/src/integrations/expressApollo.ts#L94So propose solution should be...
Which maybe somehow related to #144
Any thought?
The text was updated successfully, but these errors were encountered: