I have read the popular blog post https://www.stevejgordon.co.uk/introduction-to-httpclientfactory-aspnetcore on using HttpClientFactory
To quote from it
Just providing sample code for the first suggested approach in the accepted answer:
services.AddHttpClient(); // where services is of type IServiceCollection
and your class looks like:
public class Foo : IFoo
{
private readonly HttpClient httpClient;
public Consumer(HttpClient httpClient)
{
this.httpClient = httpClient;
}
}