Created
August 9, 2019 02:06
-
-
Save dcomartin/3280bbdcc6797f0265ce777a9bb4bd90 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
using Amazon.CloudWatch; | |
using Microsoft.AspNetCore.Builder; | |
using Microsoft.AspNetCore.Hosting; | |
using Microsoft.AspNetCore.Http; | |
using Microsoft.Extensions.Configuration; | |
using Microsoft.Extensions.DependencyInjection; | |
using Microsoft.Extensions.Logging; | |
namespace AspNetCore.Aws.Demo | |
{ | |
public class Startup | |
{ | |
private readonly IConfiguration _configuration; | |
public Startup(IConfiguration configuration) | |
{ | |
_configuration = configuration; | |
} | |
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddLogging(builder => | |
{ | |
builder.AddConsole(); | |
builder.AddDebug(); | |
} | |
); | |
services.AddDefaultAWSOptions(_configuration.GetAWSOptions()); | |
services.AddAWSService<IAmazonCloudWatch>(); | |
} | |
public void Configure(IApplicationBuilder app, IHostingEnvironment env) | |
{ | |
if (env.IsDevelopment()) | |
{ | |
app.UseDeveloperExceptionPage(); | |
} | |
app.UseMiddleware<CloudWatchExecutionTimeMiddleware>(); | |
app.Run(async (context) => | |
{ | |
await context.Response.WriteAsync("Hello World!"); | |
}); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment