Skip to content

Commit

Permalink
Clean up Program.cs (open-telemetry#754)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfowl committed Feb 22, 2023
1 parent 1d2684b commit 9639fd1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ release.
([#729](https://github.com/open-telemetry/opentelemetry-demo/issues/729))
* rename proto package from hipstershop to oteldemo
([#740](https://github.com/open-telemetry/opentelemetry-demo/pull/740))
* Removed unnecessary code from Program.cs

## v0.1.0

Expand Down
20 changes: 5 additions & 15 deletions src/cartservice/src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
cartStore = new RedisCartStore(redisAddress);

// Initialize the redis store
cartStore.InitializeAsync().GetAwaiter().GetResult();
await cartStore.InitializeAsync();
Console.WriteLine("Initialization completed");

builder.Services.AddSingleton<ICartStore>(cartStore);
Expand Down Expand Up @@ -72,22 +72,12 @@

var app = builder.Build();

if (app.Environment.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.MapGrpcService<CartService>();
app.MapGrpcHealthChecksService();

app.UseRouting();

app.UseEndpoints(endpoints =>
app.MapGet("/", async context =>
{
endpoints.MapGrpcService<CartService>();
endpoints.MapGrpcHealthChecksService();
endpoints.MapGet("/", async context =>
{
await context.Response.WriteAsync("Communication with gRPC endpoints must be made through a gRPC client. To learn how to create a client, visit: https://go.microsoft.com/fwlink/?linkid=2086909");
});
await context.Response.WriteAsync("Communication with gRPC endpoints must be made through a gRPC client. To learn how to create a client, visit: https://go.microsoft.com/fwlink/?linkid=2086909");
});

app.Run();

0 comments on commit 9639fd1

Please sign in to comment.