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个字符

Program.cs 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. global using Microsoft.AspNetCore.Components.Authorization;
  2. using Blazored.LocalStorage;
  3. using Blazorise;
  4. using Blazorise.Bootstrap;
  5. using Blazorise.Icons.FontAwesome;
  6. using Grpc.Net.Client;
  7. using Grpc.Net.Client.Web;
  8. using Microsoft.AspNetCore.Components;
  9. using Microsoft.AspNetCore.Components.Web;
  10. using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
  11. using MudBlazor.Services;
  12. using NemAnBlazor;
  13. using NemAnBlazor.Services;
  14. using NemAnBlazor.Services.Interfaces;
  15. var builder = WebAssemblyHostBuilder.CreateDefault(args);
  16. builder.RootComponents.Add<App>("#app");
  17. builder.RootComponents.Add<HeadOutlet>("head::after");
  18. builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
  19. builder.Services.AddScoped(_ =>
  20. {
  21. var grpcWebHandler = new GrpcWebHandler(GrpcWebMode.GrpcWeb, new HttpClientHandler());
  22. var channel = GrpcChannel.ForAddress(builder.HostEnvironment.BaseAddress, new GrpcChannelOptions { HttpHandler = grpcWebHandler });
  23. return channel;
  24. });
  25. builder.Services.AddAuthorizationCore();
  26. //builder.Services.AddScoped<AuthenticationStateProvider, AuthClientService>();
  27. builder.Services
  28. .AddBlazorise(options =>
  29. {
  30. options.Immediate = true;
  31. })
  32. .AddBootstrapProviders()
  33. .AddFontAwesomeIcons();
  34. builder.Services.AddScoped<ITrackClientService, TrackClientService>();
  35. builder.Services.AddScoped<IAuthClientService, AuthClientService>();
  36. builder.Services.AddScoped<IStatsClientService, StatsClientService>();
  37. builder.Services.AddScoped<IIdentityClientService, IdentityClientService>();
  38. builder.Services.AddBlazoredLocalStorage();
  39. builder.Services.AddScoped<AuthenticationStateProvider, AuthClientService>();
  40. builder.Services.AddAuthorizationCore();
  41. await builder.Build().RunAsync();