WeatherDashboard/WeatherDashboard.Web/Program.cs

29 lines
645 B
C#
Raw Permalink Normal View History

2023-02-10 03:33:02 +00:00
using WeatherDashboard.Web.Services;
2023-02-09 02:30:14 +00:00
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllersWithViews();
2023-02-10 03:33:02 +00:00
builder.Services.AddHttpClient();
2023-03-18 15:35:15 +00:00
builder.Services.AddSingleton<IForecastService, WeatherApiForecastService>();
2023-02-09 02:30:14 +00:00
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Home/Error");
2023-02-16 15:11:17 +00:00
app.UseHttpsRedirection();
2023-02-09 02:30:14 +00:00
}
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
app.Run();