public GraphQLMiddleware(RequestDelegate next, IDocumentWriter writer, IDocumentExecuter executer, PoCSchema schema) { _next = next; _writer = writer; _executer = executer; _schema = schema; }
public async Task Invoke(HttpContext context, PoCSchema schema) { if (!IsGraphQLRequest(context)) { await _next(context); return; } await ExecuteAsync(context, schema); }
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); }