Open TrySound opened 3 years ago
cc @IvanGoncharov
excellent idea for decoupling from express.
after a quick review:
also i think it makes sense to append this to the options interface rather than introducing a second argument
Hi @acao
also i think it makes sense to append this to the options interface rather than introducing a second argument
It would look better in options though options getter depends on parsed options.
See here https://github.com/graphql/express-graphql/blob/master/src/index.ts#L231
should there be a change to package lock without dependency changes?
Probably not. I just committed what npm i
gives. I usually use yarn which does not introduce any changes unless packages upgraded explicitly.
potentially the function could be named more descriptively? also i think “custom” is a given in this case
I don't know, maybe customGetGraphQLParams
?
@acao I figured how to move it into options. Now builtin getGraphQLParams is called only for options getter. When only object is passed first look for customGraphQLParamsFn field.
Hi @acao. What do you think?
@TrySound you did move the option to where I was hoping, awesome!
@TrySound You can parse body yourself and replace body inside Request https://github.com/graphql/express-graphql/blob/0fa7ace4f94fc25708a9f1e68a29775ceb623a25/src/parseBody.ts#L34-L38
Also, I'm worried that it will affect our effort to standardize the HTTP protocol for GraphQL:
https://github.com/graphql/graphql-over-http
As a reference GraphQL over HTTP server, we provide the ability to use non-standard names like graphqlQuery
.
In my app I'm trying to move away from express.
We also have a plan to do that so we can support Koa, AWS Lambdas, Deno frameworks, etc.
We currently blocked by TS migration of graphql-js
but this is planned for the 1.0
release, see https://github.com/graphql/express-graphql/issues/675
You can parse body yourself and replace body inside Request
Yes, I do request pollution now though it's not very clean.
Also, I'm worried that it will affect our effort to standardize the HTTP protocol for GraphQL:
My change allows to move everything to userland and use any non-standard names. Any framework could be integrated here as well.
In my app I'm trying to move away from express. I implemented own body parser to not pollute
request
object. Though in this case express-graphql is trying to parse body by itself which leads to hanging server because there are no more events on request.In this diff I added a way to custom extracting params from request. It would look better in options though options getter depends on parsed options.