public async Task FunctionHandler()

in dotnet6/hello-pt/{{cookiecutter.project_name}}/src/HelloWorld/Function.cs [74:96]


        public async Task<APIGatewayProxyResponse> FunctionHandler(APIGatewayProxyRequest apigProxyEvent, ILambdaContext context)
        {

            var location = await GetCallingIP();
            var body = new Dictionary<string, string>
            {
                { "message", "hello world" },
                { "location", location }
            };

            {%- if cookiecutter["Powertools for AWS Lambda (.NET) Logging"] == "enabled" %}
            // Structured logging
            // https://awslabs.github.io/aws-lambda-powertools-dotnet/core/logging/
            Logger.LogInformation("Hello world API - HTTP 200");
            {%- endif %}

            return new APIGatewayProxyResponse
            {
                Body = JsonSerializer.Serialize(body),
                StatusCode = 200,
                Headers = new Dictionary<string, string> { { "Content-Type", "application/json" } }
            };
        }