Startup.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using HyperCube.Data;
  2. using Microsoft.AspNetCore.Builder;
  3. using Microsoft.AspNetCore.Components;
  4. using Microsoft.AspNetCore.Hosting;
  5. using Microsoft.Extensions.Configuration;
  6. using Microsoft.Extensions.DependencyInjection;
  7. using Microsoft.Extensions.Hosting;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Linq;
  11. using System.Threading.Tasks;
  12. namespace HyperCube
  13. {
  14. public class Startup
  15. {
  16. public Startup(IConfiguration configuration)
  17. {
  18. Configuration = configuration;
  19. }
  20. public IConfiguration Configuration { get; }
  21. // This method gets called by the runtime. Use this method to add services to the container.
  22. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
  23. public void ConfigureServices(IServiceCollection services)
  24. {
  25. services.AddRazorPages();
  26. services.AddServerSideBlazor();
  27. services.AddSingleton<WeatherForecastService>();
  28. }
  29. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
  30. public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
  31. {
  32. if (env.IsDevelopment())
  33. {
  34. app.UseDeveloperExceptionPage();
  35. }
  36. else
  37. {
  38. app.UseExceptionHandler("/Error");
  39. }
  40. app.UseStaticFiles();
  41. app.UseRouting();
  42. app.UseEndpoints(endpoints =>
  43. {
  44. endpoints.MapBlazorHub();
  45. endpoints.MapFallbackToPage("/_Host");
  46. });
  47. }
  48. }
  49. }