Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Last active June 28, 2018 20:47
Show Gist options
  • Save dcomartin/b690310ce5bfa2b67ec0659c92d0bffc to your computer and use it in GitHub Desktop.
Save dcomartin/b690310ce5bfa2b67ec0659c92d0bffc to your computer and use it in GitHub Desktop.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.Use(async (context, func) =>
{
if (context.Request.Path.Value == "/hc")
{
context.Response.StatusCode = 200;
context.Response.ContentLength = 2;
await context.Response.WriteAsync("UP");
}
else
{
await func.Invoke();
}
});
app.Run(async (context) =>
{
await context.Response.WriteAsync("Hello World!");
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment