Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created August 9, 2019 02:06
Show Gist options
  • Save dcomartin/3280bbdcc6797f0265ce777a9bb4bd90 to your computer and use it in GitHub Desktop.
Save dcomartin/3280bbdcc6797f0265ce777a9bb4bd90 to your computer and use it in GitHub Desktop.
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