diff --git a/WeatherDashboard.Console/Program.cs b/WeatherDashboard.Console/Program.cs index 3751555..f9b23c1 100644 --- a/WeatherDashboard.Console/Program.cs +++ b/WeatherDashboard.Console/Program.cs @@ -1,2 +1,24 @@ -// See https://aka.ms/new-console-template for more information -Console.WriteLine("Hello, World!"); +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; + +var builder = Host.CreateDefaultBuilder(args); + +builder.ConfigureAppConfiguration(config => +{ + config.AddJsonFile("settings.json"); +}); + +builder.ConfigureServices(services => +{ + services.AddHttpClient(); +}); + +var app = builder.Build(); + +var configuration = app.Services.GetService(); +var httpClientFactory = app.Services.GetService(); + +var httpClient = httpClientFactory.CreateClient(); +var apiUrl = configuration["ApiUrl"]; + diff --git a/WeatherDashboard.Console/WeatherDashboard.Console.csproj b/WeatherDashboard.Console/WeatherDashboard.Console.csproj index 06e15a0..41506a9 100644 --- a/WeatherDashboard.Console/WeatherDashboard.Console.csproj +++ b/WeatherDashboard.Console/WeatherDashboard.Console.csproj @@ -9,6 +9,8 @@ + + diff --git a/WeatherDashboard.Console/settings.Development.json b/WeatherDashboard.Console/settings.Development.json new file mode 100644 index 0000000..e69de29 diff --git a/WeatherDashboard.Console/settings.json b/WeatherDashboard.Console/settings.json new file mode 100644 index 0000000..2da2e90 --- /dev/null +++ b/WeatherDashboard.Console/settings.json @@ -0,0 +1,3 @@ +{ + "ApiUrl": "https://weather.binarydad.com/api" +} \ No newline at end of file