-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathStarWarsFunctionEndpoint.cs
34 lines (29 loc) · 1.24 KB
/
StarWarsFunctionEndpoint.cs
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
26
27
28
29
30
31
32
33
34
using System;
using System.Threading.Tasks;
using HotChocolate.AzureFunctionsProxy;
using HotChocolate.AzureFunctionsProxy.IsolatedProcess;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Http;
using Microsoft.Extensions.Logging;
namespace StarWars.AzureFunctionsIsolatedProcess
{
public class StarWarsFunctionEndpoint
{
private readonly IGraphQLAzureFunctionsExecutorProxy _graphqlExecutorProxy;
public StarWarsFunctionEndpoint(IGraphQLAzureFunctionsExecutorProxy graphqlExecutorProxy)
{
_graphqlExecutorProxy = graphqlExecutorProxy;
}
[Function(nameof(StarWarsFunctionEndpoint))]
public async Task<HttpResponseData> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = "graphql")] HttpRequestData req,
FunctionContext executionContext
)
{
var logger = executionContext.GetLogger<StarWarsFunctionEndpoint>();
logger.LogInformation("C# GraphQL Request processing via Serverless AzureFunctions (Isolated Process)...");
var response = await _graphqlExecutorProxy.ExecuteFunctionsQueryAsync(req, logger).ConfigureAwait(false);
return response;
}
}
}