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 967B

12345678910111213141516171819202122232425262728293031323334353637
  1. using Grpc.Net.Client;
  2. using SpotifyService.Services;
  3. var builder = WebApplication.CreateBuilder(args);
  4. // Additional configuration is required to successfully run gRPC on macOS.
  5. // For instructions on how to configure Kestrel and gRPC clients on macOS, visit https://go.microsoft.com/fwlink/?linkid=2099682
  6. // Add services to the container.
  7. builder.Services.AddGrpc();
  8. builder.Services.AddHttpClient();
  9. builder.Services.AddCors(o => o.AddPolicy("AllowAll", builder =>
  10. {
  11. builder.AllowAnyOrigin()
  12. .AllowAnyMethod()
  13. .AllowAnyHeader()
  14. .WithExposedHeaders("Grpc-Status", "Grpc-Message", "Grpc-Encoding", "Grpc-Accept-Encoding");
  15. }));
  16. var app = builder.Build();
  17. app.UseRouting();
  18. app.UseCors();
  19. // Configure the HTTP request pipeline.
  20. app.MapGrpcService<SearchService>();
  21. app.UseGrpcWeb();
  22. app.UseEndpoints(endpoints =>
  23. {
  24. endpoints.MapGrpcService<SearchService>().EnableGrpcWeb().RequireCors("AllowAll");
  25. });
  26. app.Run();