Skip to content

eijithebuilder/weather-api-react

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

WeatherApp

A simple weather application with ASP.NET Core backend and React + Vite frontend.
Fetches real-time weather data from OpenWeather API and displays current weather conditions for any location.

Features

  • Fetch weather data from OpenWeather API
  • Display current conditions, temperature, feels like, humidity, wind speed, description
  • Search for any city
  • Error handling: empty input, location not found, API key issues

Project Structure

WeatherApp/
├── weather-api/ # backend
├── weather-frontend/ # frontend

Backend

  1. Configure API key in environment variable:

    export API_KEY=your_openweather_api_key   # Linux/macOS
    setx API_KEY "your_openweather_api_key"  # Windows
  2. Build and run:

    cd weather-api
    dotnet restore
    dotnet build
    dotnet run
  3. API endpoint:

    GET http://localhost:5131/api/Weather?location=<city>
  4. Example response:

    {
        "location": "Tokyo",
        "condition": "Rain",
        "description": "light rain",
        "animationCode": "rainy",
        "temperature": 27,
        "feelsLike": 31,
        "humidity": 92,
        "windSpeed": 2.34,
        "lastUpdated": "2025-10-11T11:14:42Z"
    }

Frontend

  1. Install dependencies:

    cd WeatherFrontend
    npm install
  2. Run dev server:

    npm run dev
  3. Open browser at http://localhost:5173 (Vite default)

  4. Enter city name and press Enter or click Search to fetch weather.

Notes

  • Backend uses ILogger<WeatherService> for logging

  • React frontend handles errors from backend and displays messages to user

  • API key is not committed; use .env or environment variables

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published