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.

HttpUtils.cs 638B

123456789101112131415161718192021222324
  1. using Grpc.Net.Client;
  2. using Microsoft.Net.Http.Headers;
  3. using Newtonsoft.Json;
  4. namespace SpotifyService.HttpUtils
  5. {
  6. public static class HttpUtils<T>
  7. {
  8. public static async Task<T> GetData(HttpClient client, string url, string token)
  9. {
  10. //add header
  11. client.DefaultRequestHeaders.Add(HeaderNames.Authorization, "Bearer " + token);
  12. //get request
  13. var req = await client.GetAsync(url);
  14. //read response
  15. var response = JsonConvert.DeserializeObject<T>(await req.Content.ReadAsStringAsync())!;
  16. return response;
  17. }
  18. }
  19. }