マルチスレッド対応で、非同期処理の実現が容易 • 静的型付け言語 • 活発なコミュニティ • Semantic Kernelなど最近のLLMを活用するフレームワークも 充実 • The modern, innovative, open-source programming language for building all your apps • Microsoft製品との親和性が高いのは事実だが、AWSでも強力 にサポートされている
LambdaMathAdd(APIGatewayHttpApiV2ProxyRequest request, ILambdaContext context) { if (!request.PathParameters.TryGetValue("x", out var xs)) { return new APIGatewayHttpApiV2ProxyResponse { StatusCode = (int)HttpStatusCode.BadRequest }; } if (!request.PathParameters.TryGetValue("y", out var ys)) { return new APIGatewayHttpApiV2ProxyResponse { StatusCode = (int)HttpStatusCode.BadRequest }; } var x = int.Parse(xs); var y = int.Parse(ys); return new APIGatewayHttpApiV2ProxyResponse { StatusCode = (int)HttpStatusCode.OK, Body = (x + y).ToString(), Headers = new Dictionary≪string, string> { { "Content-Type", "text/plain" } } }; } リクエストのパスパラメータをチェック して、xを取得 なければBadRequestを返す リクエストのパスパラメータをチェック して、yを取得 なければBadRequestを返す x + yの結果をBodyに入れて、200 OKを返 す Content-typeはtext/plain