Skip to content

MuhammadUsmanSaboor/Weather_socut

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Weather Scout

A local weather web app built on Open-Meteo — free, no API key.

Enter any city name to get current conditions, a 12-hour rain-probability chart, and a 7-day forecast.


How to run

Option A — Python (no install)

git clone https://github.com/your-username/weather-scout.git
cd weather-scout
python3 -m http.server 8080

Open http://localhost:8080 in your browser.

Option B — Node (if you have it)

npx serve .

That's it. No .env, no npm install, no build step. Open-Meteo is public and free.

Why a local server? The app uses ES modules (type="module"), which browsers block on file:// for security reasons. Any HTTP server fixes this.


What it does that the API docs don't

  • Type a city name → if it's ambiguous (e.g. "Springfield") you get a picker showing country/region so you choose the right one
  • Current conditions + apparent temperature (feels-like)
  • 12-hour precipitation probability bar chart
  • 7-day high/low forecast
  • Handles slow API (8-second timeout with a clear message), API errors, and bad input (empty field, typos, unknown cities)

Project layout

index.html          Entry point + all styles
src/
  api.js            Geocoding + forecast fetch, timeout logic, WMO code map
  ui.js             DOM rendering (card, picker, errors, loading state)
  main.js           Event wiring, orchestrates geocode → weather flow

Notes

  • Temperatures in Celsius (Open-Meteo default). Pass temperature_unit=fahrenheit to the URL params in api.js to change it.
  • The app works fine on mobile; the 7-day forecast collapses to 4 days below 440px.

About

Weather app built on Open-Meteo city search with 7-day forecast, rain probability chart, and graceful error handling. No API key required.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors