add new snippet (#68)

pull/69/head
Rick Anderson 2022-09-22 16:42:19 -10:00 committed by GitHub
parent 839b3d42de
commit 4061c06d00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 2 deletions

View File

@ -1,4 +1,4 @@
#define API_CONTROLLER // MIDDLEWARE API_CONTROLLER API_CONT_SHORT DEFAULT
#define DISABLE // MIDDLEWARE API_CONTROLLER API_CONT_SHORT DEFAULT DISABLE
#if NEVER
#elif MIDDLEWARE
// <snippet_middleware>
@ -169,7 +169,6 @@ app.MapControllers();
app.Run();
// </snippet_default>
#elif MIN_API
// <snippet_min_api>
var builder = WebApplication.CreateBuilder(args);
@ -245,4 +244,24 @@ app.MapGet("/squareroot", (HttpContext context, double radicand) =>
app.Run();
// </snippet_min_api>
#elif DISABLE
// <snippet_disable>
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers()
.ConfigureApiBehaviorOptions(options =>
{
options.SuppressMapClientErrors = true;
});
var app = builder.Build();
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();
// </snippet_disable>
#endif