// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using Microsoft.AspNetCore.Diagnostics.HealthChecks; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Options; namespace Microsoft.AspNetCore.Builder { /// /// extension methods for the . /// public static class HealthCheckAppBuilderExtensions { /// /// Adds a middleware that provides a REST API for requesting health check status. /// /// The . /// The path on which to provide the API. /// A reference to the after the operation has completed. public static IApplicationBuilder UseHealthChecks(this IApplicationBuilder app, PathString path) { app = app ?? throw new ArgumentNullException(nameof(app)); return app.UseMiddleware(Options.Create(new HealthCheckOptions() { Path = path })); } } }