public async Task FunctionHandler()

in dotnet-app/src/ServerlessExample/Function.cs [32:65]


        public async Task<APIGatewayProxyResponse> FunctionHandler(APIGatewayProxyRequest apigProxyEvent, ILambdaContext context)
        {
            context.Logger.LogLine("Entry\n");
            context.Logger.LogLine(System.Text.Json.JsonSerializer.Serialize(apigProxyEvent));
            try
            {
            if (apigProxyEvent?.Path?.Equals("/favicon.ico") == true)
            {
                return new APIGatewayProxyResponse
                {
                    Body = Convert.ToBase64String(File.ReadAllBytes("favicon.ico")),
                    StatusCode = 200,
                    IsBase64Encoded = true,
                    Headers = new Dictionary<string, string> { { "Content-Type", "image/vnd.microsoft.icon" } }
                };
            }
            } catch (Exception e) {
                context.Logger.LogLine(e.ToString());
            }

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

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