Spotify.NET/SpotifyAPI.Web.Examples/Example.ASPBlazor/Startup.cs

55 lines
1.6 KiB
C#
Raw Normal View History

2022-11-27 12:29:35 +00:00
using Example.ASPBlazor.Data;
2020-05-22 11:23:25 +01:00
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace Example.ASPBlazor
{
2022-11-27 12:29:35 +00:00
public class Startup
{
public Startup(IConfiguration configuration)
2020-05-22 11:23:25 +01:00
{
2022-11-27 12:29:35 +00:00
Configuration = configuration;
}
2020-05-22 11:23:25 +01:00
2022-11-27 12:29:35 +00:00
public IConfiguration Configuration { get; }
2020-05-22 11:23:25 +01:00
2022-11-27 12:29:35 +00:00
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
services.AddRazorPages();
services.AddServerSideBlazor();
services.AddSingleton<WeatherForecastService>();
}
2020-05-22 11:23:25 +01:00
2022-11-27 12:29:35 +00:00
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
2020-05-22 11:23:25 +01:00
2022-11-27 12:29:35 +00:00
app.UseHttpsRedirection();
app.UseStaticFiles();
2020-05-22 11:23:25 +01:00
2022-11-27 12:29:35 +00:00
app.UseRouting();
2020-05-22 11:23:25 +01:00
2022-11-27 12:29:35 +00:00
app.UseEndpoints(endpoints =>
{
endpoints.MapBlazorHub();
endpoints.MapFallbackToPage("/_Host");
});
2020-05-22 11:23:25 +01:00
}
2022-11-27 12:29:35 +00:00
}
2020-05-22 11:23:25 +01:00
}