Creating a client application
Having the library in place, let’s create a client application. A simple console application fulfils the purpose to play the game. With the sample application of this chapter, the NuGet packages Microsoft.Extensions.Hosting
, Microsoft.Extensions.Http.Resiliency
, and Spectre.Console.Cli
are added. Navigate to the folder of the solution file before invoking these commands:
dotnet new console –framework net8.0 -o Codebreaker.Console cd Codebreaker.Console dotnet add package Microsoft.Extensions.Hosting dotnet add package Microsoft.Extensions.Http.Resilience dotnet add package Spectre.Console.Cli dotnet add reference ../Codebreaker.GameAPIs.Client
Microsoft.Extensions.Hosting
will be used for a dependency injection container and configuration support and Microsoft.Extensions.Http.Resilience
is the package offering an HttpClientFactory
. Of course, the library created previously needs to be referenced as well.
To interact with the user...