endpoints.MapGet("/products", (context) => { var products = app.ApplicationServices.GetService().GetProducts(); var json = JsonSerializer.Serialize>(products); return context.Response.WriteAsync(json); });