简体   繁体   English

将 ASP.NET API 转换为 AWS Lambda

[英]Converting ASP.NET API To AWS Lambdas

I have a asp.net core 3.1 API application that I have been using as my backend api.我有一个 asp.net core 3.1 API 应用程序,我一直将其用作后端 api。

I have this application hosted in one AWS Lambda Function, with API Gateway, with one HTTP route and having the ASP.NET Core application handle the routing.我将此应用程序托管在一个 AWS Lambda Function、API 网关和一个 HTTP 路由中,并让 ASP.NET Core 应用程序处理路由。

Looking around the web and reading docs, it seems the standard would be to have one HTTP API Route per Lambda Function, (So as I interpreted it would mean having every ASP.NET controller of my API in one lambda function). Looking around the web and reading docs, it seems the standard would be to have one HTTP API Route per Lambda Function, (So as I interpreted it would mean having every ASP.NET controller of my API in one lambda function).

Meaning since I have 14 routes it would seems I would need 14 lambda functions with API endpoints.这意味着因为我有 14 条路线,所以我似乎需要 14 个 lambda 函数和 API 端点。 Also this would mean basically no longer having a ASP.NET core API, and disassembling the application.这也意味着基本上不再有 ASP.NET 核心 API,并反汇编应用程序。

I have no issues in completing this, just wanted to know if this is actually the correct why and the new normal in developing api's.我在完成这个方面没有任何问题,只是想知道这是否真的是开发 api 的正确原因和新常态。

It is possible to route several endpoints to the same lambda function as explained here .可以将多个端点路由到同一个 lambda function,如此所述。 But I believe most people try to use one lambda per endpoint.但我相信大多数人都尝试为每个端点使用一个 lambda。

As for what you say about the new normal in developing APIs i would caution you to believe the hype too much.至于你所说的关于开发 API 的新常态,我会提醒你不要过度相信炒作。 Serverless definitely has a place in modern web development but it is not replacing traditional APIs that i have seen where i have worked.无服务器在现代 web 开发中肯定占有一席之地,但它并没有取代我在工作中看到的传统 API。

Yes, one lambda for endpoint (not per controller)是的,一个 lambda 用于端点(不是每个控制器)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM