Amazon.Lambda.AspNetCoreServer Class

Amazon.Lambda.AspNetCoreServer makes it easy to run ASP.NET Core Web API applications as AWS Lambda functions. Using this class makes it possible to use what you already know about Microsoft WebApi projects in your Lambda Function development; Dependency Injection, Configuration Extensions, Controllers, etc. -- all that good stuff is at your disposal.

Microsoft WebApi projects use dependency injection to reference one or more classes derived from Microsoft.AspNetCore.Mvc.ControllerBase. Controller classes implement Lambda Function Event methods that call an implementation of the interface that you provide.

One controller class is generated for each OpenApi tag. For instance, in the example below, the tag named "order" generates the interface IOrderController and class OrderController.

Note that LazyStack instructs NSwag to generate controller methods that return an ActionResult.

When you add routes to your OpenApi specification, LazyStack uses NSwag to create/update your controller projects.

LazyStack generates a Lambda Function project and a Controller project for each tag. A Controller class is referenced in the local WebApi project as well as a Lambda Function project. This is done to facilitate simple local debugging of the Controller classes using the local WebApi project and the development of test suites. The local WebApi project references all Controller classes in the solution while each Lambda Function references only a single Controller class.