A beautiful, responsive weather dashboard with server-side API protection.
Frontend:
Backend:
weather-dashboard/
├── client/
│ ├── index.html
│ ├── styles.css
│ └── script.js
├── server/
│ ├── server.js
│ ├── package.json
│ ├── .env.example
│ └── .gitignore
└── README.md
git clone https://github.com/your-username/weather-dashboard.git
cd weather-dashboard
cd server
npm install
cp .env.example .env
# Edit .env with your API key
npm run dev
Create a server/.env
file with the following:
PORT=3000
OPENWEATHER_API_KEY=your_api_key_here
NODE_ENV=development
Method | Endpoint | Description |
---|---|---|
GET | /api/health |
Health check |
GET | /api/weather/current?city=London |
Current weather |
GET | /api/weather/forecast?city=London |
5-day forecast |
GET | /api/weather/coordinates?lat=51.5074&lon=0.1278 |
Weather by coordinates |
✅ API key protection (server-side only)
✅ Rate limiting (60 requests/minute)
✅ Input validation
✅ CORS configuration
✅ Error handling without sensitive data exposure
git checkout -b feature/AmazingFeature
git commit -m "Add some AmazingFeature"
git push origin feature/AmazingFeature
This project is licensed under the MIT License — see the LICENSE file for details.
# Server Configuration
PORT=3000
# OpenWeatherMap API Key
# Get your free API key from: https://openweathermap.org/api
OPENWEATHER_API_KEY=your_api_key_here
# Environment
NODE_ENV=development
# Stage and commit files
git add .
git commit -m "Initial commit: Weather dashboard with server-side API protection"
# Add your GitHub remote (if not set)
git remote add origin https://github.com/Adebayo-makemoney/weather-dashboard.git
# Push to GitHub
git branch -M main
git push -u origin main
✅ Safe to push:
server/.env.example
server/package.json
README.md
.gitignore
❌ Never push:
server/.env
(with real API key)server/node_modules/