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.
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

Program.cs 1.5KB

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