Blazor & WASM in combination to get statistics from Spotify API for performing the song analysis. With separate microservices for auth, Spotify, user data tracking, and application, connected through gRPC with Polly.
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using GrpcShared;
  2. using IdentityProvider.Services;
  3. using Microsoft.AspNetCore.Server.Kestrel.Core;
  4. using ProtoBuf.Grpc.Server;
  5. using Microsoft.Extensions.Options;
  6. using GrpcShared.DTO.Auth;
  7. var builder = WebApplication.CreateBuilder(args);
  8. #if DEBUG
  9. builder.WebHost.ConfigureKestrel(options =>
  10. {
  11. options.ListenLocalhost(5050, o => o.Protocols =
  12. HttpProtocols.Http2);
  13. options.ListenLocalhost(5051, o => o.Protocols =
  14. HttpProtocols.Http1AndHttp2);
  15. });
  16. #endif
  17. builder.Services.AddOptions();
  18. // Additional configuration is required to successfully run gRPC on macOS.
  19. // For instructions on how to configure Kestrel and gRPC clients on macOS, visit https://go.microsoft.com/fwlink/?linkid=2099682
  20. builder.Services.Configure<CodeRequest>(builder.Configuration.GetSection("AuthParams"));
  21. builder.Services.AddControllersWithViews();
  22. builder.Services.AddRazorPages();
  23. builder.Services.AddEndpointsApiExplorer();
  24. builder.Services.AddGrpc();
  25. builder.Services.AddCodeFirstGrpc();
  26. builder.Services.AddCodeFirstGrpcReflection();
  27. //call spotify api
  28. builder.Services.AddHttpClient();
  29. var app = builder.Build();
  30. // Configure the HTTP request pipeline.
  31. if (app.Environment.IsDevelopment())
  32. {
  33. app.UseWebAssemblyDebugging();
  34. }
  35. else
  36. {
  37. app.UseExceptionHandler("/Error");
  38. // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
  39. app.UseHsts();
  40. }
  41. app.UseHttpsRedirection();
  42. //run blazor project by running grpc server
  43. app.UseBlazorFrameworkFiles();
  44. app.UseStaticFiles();
  45. app.UseRouting();
  46. //for http2 -> http conversion
  47. app.UseGrpcWeb();
  48. app.MapRazorPages();
  49. app.MapControllers();
  50. //app.MapGrpcService<WeatherService>();
  51. app.MapGrpcService<AuthService>().EnableGrpcWeb();
  52. app.MapCodeFirstGrpcReflectionService();
  53. app.MapFallbackToFile("index.html");
  54. app.Run();