From 9194e957b7bece022dccc322599df9eeb6a8dd61 Mon Sep 17 00:00:00 2001 From: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com> Date: Thu, 22 Sep 2022 17:26:52 -1000 Subject: [PATCH] update snippets (#69) --- .../problem-details-service/Program.cs | 22 ++++--------------- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/fundamentals/middleware/problem-details-service/Program.cs b/fundamentals/middleware/problem-details-service/Program.cs index d2ffc12..a2ada2c 100644 --- a/fundamentals/middleware/problem-details-service/Program.cs +++ b/fundamentals/middleware/problem-details-service/Program.cs @@ -1,20 +1,14 @@ -#define DISABLE // MIDDLEWARE API_CONTROLLER API_CONT_SHORT DEFAULT DISABLE +#define API_CONTROLLER // MIDDLEWARE API_CONTROLLER API_CONT_SHORT DEFAULT DISABLE #if NEVER #elif MIDDLEWARE // var builder = WebApplication.CreateBuilder(args); builder.Services.AddControllers(); -builder.Services.AddEndpointsApiExplorer(); -builder.Services.AddSwaggerGen(); -builder.Services.AddProblemDetails(); -var app = builder.Build(); -if (app.Environment.IsDevelopment()) -{ - app.UseSwagger(); - app.UseSwaggerUI(); -} +builder.Services.AddProblemDetails(); + +var app = builder.Build(); app.UseHttpsRedirection(); app.UseStatusCodePages(); @@ -88,8 +82,6 @@ app.Run(); var builder = WebApplication.CreateBuilder(args); builder.Services.AddControllers(); -builder.Services.AddEndpointsApiExplorer(); -builder.Services.AddSwaggerGen(); builder.Services.AddProblemDetails(options => options.CustomizeProblemDetails = (context) => @@ -117,12 +109,6 @@ builder.Services.AddProblemDetails(options => var app = builder.Build(); -if (app.Environment.IsDevelopment()) -{ - app.UseSwagger(); - app.UseSwaggerUI(); -} - app.UseHttpsRedirection(); app.UseStatusCodePages();