-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraphQLFunction.cs
More file actions
25 lines (22 loc) · 845 Bytes
/
GraphQLFunction.cs
File metadata and controls
25 lines (22 loc) · 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using HotChocolate.AzureFunctions;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Http;
using Microsoft.Extensions.Logging;
namespace IsolatedProcessAzFun
{
public class GraphQLFunction
{
private readonly ILogger<GraphQLFunction> _logger;
private readonly IGraphQLRequestExecutor _executor;
public GraphQLFunction(ILogger<GraphQLFunction> logger, IGraphQLRequestExecutor executor)
{
_logger = logger;
_executor = executor;
}
[Function("GraphQLHttpFunction")]
public Task<HttpResponseData> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = "graphql/{**slug}")] HttpRequestData request)
=> _executor.ExecuteAsync(request);
}
}