Created
May 30, 2018 12:52
-
-
Save jbeck8176/2583a9b899f97475b8aac05ce486febd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Information" : [ | |
"This file provides default values for the deployment wizard inside Visual Studio and the AWS Lambda commands added to the .NET Core CLI.", | |
"To learn more about the Lambda commands with the .NET Core CLI execute the following command at the command line in the project root directory.", | |
"dotnet lambda help", | |
"All the command line options for the Lambda command can be specified in this file." | |
], | |
"profile":"", | |
"region" : "us-east-1", | |
"configuration" : "Release", | |
"framework" : "netcoreapp2.0" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk.Web"> | |
<PropertyGroup> | |
<TargetFramework>netcoreapp2.0</TargetFramework> | |
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles> | |
</PropertyGroup> | |
<ItemGroup> | |
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.3" /> | |
<PackageReference Include="AWSSDK.Extensions.NETCore.Setup" Version="3.3.4" /> | |
<PackageReference Include="Amazon.Lambda.AspNetCoreServer" Version="2.0.2" /> | |
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.2" /> | |
</ItemGroup> | |
<ItemGroup> | |
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.1" /> | |
<DotNetCliToolReference Include="Amazon.Lambda.Tools" Version="2.1.1" /> | |
</ItemGroup> | |
<ItemGroup> | |
<ProjectReference Include="..\AWSServerlessApiTest.Data\AWSServerlessApiTest.Data.csproj" /> | |
</ItemGroup> | |
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Net; | |
using System.Threading.Tasks; | |
using Microsoft.AspNetCore.Hosting; | |
using System.IO; | |
namespace AWSServerlessApiTest | |
{ | |
/// <summary> | |
/// This class extends from APIGatewayProxyFunction which contains the method FunctionHandlerAsync which is the | |
/// actual Lambda function entry point. The Lambda handler field should be set to | |
/// | |
/// AWSServerlessApiTest::AWSServerlessApiTest.LambdaEntryPoint::FunctionHandlerAsync | |
/// </summary> | |
public class LambdaEntryPoint : Amazon.Lambda.AspNetCoreServer.APIGatewayProxyFunction | |
{ | |
/// <summary> | |
/// The builder has configuration, logging and Amazon API Gateway already configured. The startup class | |
/// needs to be configured in this method using the UseStartup<>() method. | |
/// </summary> | |
/// <param name="builder"></param> | |
protected override void Init(IWebHostBuilder builder) | |
{ | |
builder | |
.UseStartup<Startup>(); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using Microsoft.AspNetCore; | |
using Microsoft.AspNetCore.Hosting; | |
namespace AWSServerlessApiTest | |
{ | |
/// <summary> | |
/// The Main function can be used to run the ASP.NET Core application locally using the Kestrel webserver. | |
/// </summary> | |
public class LocalEntryPoint | |
{ | |
public static void Main(string[] args) | |
{ | |
BuildWebHost(args).Run(); | |
} | |
public static IWebHost BuildWebHost(string[] args) => | |
WebHost.CreateDefaultBuilder(args) | |
.UseStartup<Startup>() | |
.Build(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment