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 символов.

FetchData.razor 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. @page "/fetchdata"
  2. @inject HttpClient Http
  3. <PageTitle>Weather forecast</PageTitle>
  4. <h1>Weather forecast</h1>
  5. <p>This component demonstrates fetching data from the server.</p>
  6. @if (forecasts == null)
  7. {
  8. <p><em>Loading...</em></p>
  9. }
  10. else
  11. {
  12. <table class="table">
  13. <thead>
  14. <tr>
  15. <th>Date</th>
  16. <th>Temp. (C)</th>
  17. <th>Temp. (F)</th>
  18. <th>Summary</th>
  19. </tr>
  20. </thead>
  21. <tbody>
  22. @foreach (var forecast in forecasts)
  23. {
  24. <tr>
  25. <td>@forecast.Date.ToShortDateString()</td>
  26. <td>@forecast.TemperatureC</td>
  27. <td>@forecast.TemperatureF</td>
  28. <td>@forecast.Summary</td>
  29. </tr>
  30. }
  31. </tbody>
  32. </table>
  33. }
  34. @code {
  35. private WeatherForecast[]? forecasts;
  36. protected override async Task OnInitializedAsync()
  37. {
  38. forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("sample-data/weather.json");
  39. }
  40. public class WeatherForecast
  41. {
  42. public DateTime Date { get; set; }
  43. public int TemperatureC { get; set; }
  44. public string? Summary { get; set; }
  45. public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
  46. }
  47. }