update snippets (#69)

pull/72/head
Rick Anderson 2022-09-22 17:26:52 -10:00 committed by GitHub
parent 4061c06d00
commit 9194e957b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 18 deletions

View File

@ -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
// <snippet_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();