Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up Program.cs #754

Merged
merged 3 commits into from
Feb 22, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();