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.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

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();