/ src / pingup / Startup.cs
Startup.cs
 1  using System;
 2  using System.Collections.Generic;
 3  using System.Linq;
 4  using System.Threading.Tasks;
 5  using Microsoft.AspNetCore.Builder;
 6  using Microsoft.AspNetCore.Components;
 7  using Microsoft.AspNetCore.Hosting;
 8  using Microsoft.AspNetCore.HttpsPolicy;
 9  using Microsoft.Extensions.Configuration;
10  using Microsoft.Extensions.DependencyInjection;
11  using Microsoft.Extensions.Hosting;
12  using PingUp.Data;
13  
14  namespace PingUp
15  {
16      public class Startup
17      {
18          public Startup(IConfiguration configuration)
19          {
20              Configuration = configuration;
21          }
22  
23          public IConfiguration Configuration { get; }
24  
25          // This method gets called by the runtime. Use this method to add services to the container.
26          // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
27          public void ConfigureServices(IServiceCollection services)
28          {
29              services.AddRazorPages();
30              services.AddServerSideBlazor();
31              services.AddSingleton<WeatherForecastService>();
32          }
33  
34          // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
35          public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
36          {
37              if (env.IsDevelopment())
38              {
39                  app.UseDeveloperExceptionPage();
40              }
41              else
42              {
43                  app.UseExceptionHandler("/Home/Error");
44                  // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
45                  app.UseHsts();
46              }
47  
48              app.UseHttpsRedirection();
49              app.UseStaticFiles();
50  
51              app.UseRouting();
52  
53              app.UseEndpoints(endpoints =>
54              {
55                  endpoints.MapBlazorHub();
56                  endpoints.MapFallbackToPage("/_Host");
57              });
58          }
59      }
60  }