start building basic console
This commit is contained in:
parent
212225f187
commit
dbdd5c4738
@ -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<IConfiguration>();
|
||||
var httpClientFactory = app.Services.GetService<IHttpClientFactory>();
|
||||
|
||||
var httpClient = httpClientFactory.CreateClient();
|
||||
var apiUrl = configuration["ApiUrl"];
|
||||
|
||||
|
@ -9,6 +9,8 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
0
WeatherDashboard.Console/settings.Development.json
Normal file
0
WeatherDashboard.Console/settings.Development.json
Normal file
3
WeatherDashboard.Console/settings.json
Normal file
3
WeatherDashboard.Console/settings.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"ApiUrl": "https://weather.binarydad.com/api"
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user