This project:
- gets the user's current location automatically,
- finds place name + weather,
- saves entries through API routes,
- shows an eye-catching weather card + map.
index.html— frontend UI and auto location flowserver.js— local Express server (fornpm start)api/locations.js— serverless GET locations routeapi/save-location.js— serverless POST save routeapi/weather.js— serverless weather route (OpenWeather with Open-Meteo fallback)api/_storage.js— storage helper (Vercel KV or memory fallback)vercel.json— Vercel config
- Install dependencies:
npm install- (Optional) Set OpenWeather key in PowerShell:
$env:OPENWEATHER_API_KEY="YOUR_OPENWEATHER_KEY"- Start app:
npm start- Open:
http://localhost:3000/index.html
- Push this folder to GitHub.
- In Vercel, Add New Project and import the repo.
- (Optional but recommended) Add environment variables in Vercel Project Settings:
OPENWEATHER_API_KEY(optional)KV_REST_API_URL(required for persistent location storage)KV_REST_API_TOKEN(required for persistent location storage)
- Deploy.
- With Vercel KV configured: saved locations persist across deployments/restarts.
- Without Vercel KV: API uses in-memory fallback (data resets on cold start/redeploy).
- Uses OpenWeather when
OPENWEATHER_API_KEYexists. - Falls back to Open-Meteo if key is missing or provider call fails.
GET /api/locationsPOST /api/save-locationGET /api/weather?lat=<value>&lon=<value>