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.
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

Program.cs 908B

123456789101112131415161718192021222324
  1. using Grpc.Net.Client;
  2. using Grpc.Net.Client.Web;
  3. using Microsoft.AspNetCore.Components;
  4. using Microsoft.AspNetCore.Components.Web;
  5. using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
  6. using NemAnBlazor;
  7. using SpotifyService.Protos;
  8. var builder = WebAssemblyHostBuilder.CreateDefault(args);
  9. builder.RootComponents.Add<App>("#app");
  10. builder.RootComponents.Add<HeadOutlet>("head::after");
  11. builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
  12. builder.Services.AddSingleton(services =>
  13. {
  14. var httpClient = new HttpClient(new GrpcWebHandler(GrpcWebMode.GrpcWeb, new HttpClientHandler()));
  15. var baseUri = services.GetRequiredService<NavigationManager>().BaseUri;
  16. var channel = GrpcChannel.ForAddress(baseUri, new GrpcChannelOptions { HttpClient = httpClient });
  17. return new Search.SearchClient(channel);
  18. });
  19. await builder.Build().RunAsync();