예제 #1
0
 public GraphQLMiddleware(RequestDelegate next, IDocumentWriter writer, IDocumentExecuter executer, PoCSchema schema)
 {
     _next     = next;
     _writer   = writer;
     _executer = executer;
     _schema   = schema;
 }
예제 #2
0
        public async Task Invoke(HttpContext context, PoCSchema schema)
        {
            if (!IsGraphQLRequest(context))
            {
                await _next(context);

                return;
            }

            await ExecuteAsync(context, schema);
        }
예제 #3
0
        private async Task ExecuteAsync(HttpContext context, PoCSchema schema)
        {
            var request = Deserialize <GraphQLRequest>(context.Request.Body);

            var result = await _executer.ExecuteAsync(_ =>
            {
                _.Schema = schema;
                _.Query  = request.Query;
            });

            // result.

            //result.Data = null;

            await WriteResponseAsync(context, result);
        }