app.Use(async (context, next) =>
{
string? path = context.Request.Path.Value?.ToLower();
if (path == "/date")
{
await context.Response.WriteAsync($"Date: {DateTime.Now.ToShortDateString()}");
}
else if (path == "/time")
{
await context.Response.WriteAsync($"Date: {DateTime.Now.ToShortTimeString()}");
}
else
{
await next.Invoke();
}
});