Closed ansarizafar closed 1 year ago
We provide the tooling (such as withPostGraphQLContext and createPostGraphQLSchema) so that you may execute queries using "graphql" itself. By doing this we allow you to make optimisations, should you so desire, e.g. Skipping the verification phase and jumping straight to execute. And of course running queries on your schema with "graphql" function is the standard way throughout the GraphQL ecosystem.
Further reading that may interest you: https://github.com/postgraphql/postgraphql/pull/209
Thanks for the info but this means graphql schema / connection pool will be created twice. It would be great If Postgraphile can at least expose schema/connection pool if not higher order query execute function.
You can pass in a shared pool to both so the pool needn't be created twice, I don't think the schema being generated twice is a huge deal - it's only done at server startup and it doesn't consume much memory but I'm open to a PR that would allow passing the schema in to the postgraphql middleware function if it's simple enough.
Postgrapgile has made a developer's life very easy. Ideally, I would still request a query execute function exported from Postgraphile.
The current status on this is that you can copy the performQuery
function from the docs and use that: https://www.graphile.org/postgraphile/usage-schema/
I'm going to leave this open though, because we can still do better.
Thanks for amazing work. I am using Postgraphile as a library and I also want to execute a query on the server without having to go through HTTP. My question is why it is to provide a pool and other configuration, why not Postgraphile just expose excuteQuery/excuteMutation functions as all other configurations are already set.