graphql-community / koa-graphql

Create a GraphQL HTTP server with Koa.
MIT License
843 stars 61 forks source link

Exposing graphql request? #64

Closed pyrossh closed 8 years ago

pyrossh commented 8 years ago

I know that you can access the request object when you initiate the middleware but is it possible for me to get the graphql request's info also so that I can log it, example:

graphqlHTTP((request, context) => {
       console.log(request.graphqlQuery);
       console.log(request.graphqlVariables);
})

Right now when I make a post request, I don't know what requests are hitting my server?

chentsulin commented 8 years ago

This is impossible at this moment. Open a new issue at express-graphql: https://github.com/graphql/express-graphql/issues/113

Relative issue: #6

sibelius commented 8 years ago

@pyros2097 have u figure it out how to do this?

@chentsulin is there any workaround for now? like logging POST data

pyrossh commented 8 years ago

Nope... I thought of doing a fork but then lost interest since it gets cumbersome to maintain it and add it as a dependency.

chentsulin commented 8 years ago

@sibelius Sorry, but there is no workaround for this now. I can add a custom logger here: https://github.com/chentsulin/koa-graphql/blob/master/src/index.js#L159, but I prefer waiting for @leebyron 's feedback in https://github.com/graphql/express-graphql/issues/113 .

chentsulin commented 8 years ago

@sibelius @pyros2097 #79 introduce a new point to extend, will this help you?

pyrossh commented 8 years ago

Yep!

sibelius commented 8 years ago

tks