Веб-приложение для отображения текущей погоды и прогноза погоды в Москве.
Приложение получает данные из WeatherAPI и отображает:
- текущую температуру и погодные условия;
- ощущаемую температуру;
- влажность, атмосферное давление и ветер;
- оставшиеся часы текущего дня;
- почасовой прогноз на следующий день;
- прогноз погоды на 3 дня;
- состояние загрузки;
- обработку ошибок с возможностью повторного запроса.
- .NET 10
- ASP.NET Core
- Blazor Server (Interactive Server)
- MediatR
- System.Text.Json
- WeatherAPI
Решение состоит из трех проектов:
Пользовательский интерфейс приложения на Blazor Server.
Отвечает за отображение погоды, состояния загрузки, ошибок и повторный запрос данных.
Прикладной слой приложения.
Содержит:
- модели приложения;
- MediatR queries и handlers;
- абстракции для получения данных о погоде.
Инфраструктурный слой.
Содержит:
- интеграцию с WeatherAPI;
- HTTP-клиент;
- модели ответа WeatherAPI;
- преобразование данных внешнего API в модели приложения;
- регистрацию инфраструктурных зависимостей.
Для получения данных используется WeatherAPI:
forecast.json?days=3
Один запрос содержит текущую погоду, почасовой прогноз и прогноз на три дня.
Город Москва задается фиксированными координатами в конфигурации приложения.
Требуется .NET 10 SDK.
- Клонировать репозиторий.
- Открыть
WeatherApp.sln. - Установить
WeatherApp.Webв качестве startup project. - Запустить приложение.
A web application that displays current weather conditions and a weather forecast for Moscow.
The application retrieves data from WeatherAPI and displays:
- current temperature and weather conditions;
- feels-like temperature;
- humidity, atmospheric pressure and wind;
- remaining hours of the current day;
- hourly forecast for the next day;
- 3-day weather forecast;
- loading state;
- error handling with the ability to retry the request.
- .NET 10
- ASP.NET Core
- Blazor Server (Interactive Server)
- MediatR
- System.Text.Json
- WeatherAPI
The solution consists of three projects:
The Blazor Server user interface.
Responsible for displaying weather data, loading and error states, and retrying failed requests.
Application layer.
Contains:
- application models;
- MediatR queries and handlers;
- abstractions for retrieving weather data.
Infrastructure layer.
Contains:
- WeatherAPI integration;
- HTTP client;
- WeatherAPI response models;
- mapping of external API data to application models;
- infrastructure dependency registration.
Weather data is retrieved from WeatherAPI using:
forecast.json?days=3
A single request provides current weather conditions, hourly forecast data, and the three-day forecast.
Moscow is configured using fixed coordinates in the application configuration.
.NET 10 SDK is required.
- Clone the repository.
- Open
WeatherApp.sln. - Set
WeatherApp.Webas the startup project. - Run the application.