Skip to content

Instantly share code, notes, and snippets.

@JuergenGutsch
Created November 23, 2022 21:15
Show Gist options
  • Save JuergenGutsch/c11ae11db266f033c04817f2f68f5e51 to your computer and use it in GitHub Desktop.
Save JuergenGutsch/c11ae11db266f033c04817f2f68f5e51 to your computer and use it in GitHub Desktop.
namespace RoutingSample;
public static class MapMyHealthChecksExtensions
{
public static IEndpointConventionBuilder MapMyHealthChecks(
this IEndpointRouteBuilder endpoints, string pattern = "/myhealth")
{
var pipeline = endpoints
.CreateApplicationBuilder()
.UseMiddleware<MyHealthChecksMiddleware>()
.Build();
return endpoints.Map(pattern, pipeline)
.WithDisplayName("My custom health checks");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment