Merge pull request #32372 from dotnet/captainsafia-patch-1

Put Swagger UI behind an environment check
pull/32374/head
Rick Anderson 2024-04-22 14:26:32 -10:00 committed by GitHub
commit b4ee3c601d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 2 deletions

View File

@ -28,10 +28,13 @@ namespace TodoApi
// Register the Swagger generator and the Swagger UI middlewares
app.UseOpenApi();
app.UseSwaggerUi3();
if (app.Environment.IsDevelopment())
{
app.UseSwaggerUi3();
}
app.UseMvc();
}
// </snippet_Configure>
}
}
}