Express.js server providing weather data API for the Weather Dashboard frontend.
- REST API endpoint for weather data
- Mock dataset with 8 cities
- Random temperature variations for dynamic data
- CORS enabled for frontend integration
- Health check endpoint
- Install dependencies:
npm install- Start the server:
# Development mode (with auto-restart)
npm run dev
# Production mode
npm startThe server will run on http://localhost:4000
Returns weather data for the specified city.
Response:
{
"city": "New York",
"temp": 24,
"condition": "sunny"
}Health check endpoint.
Response:
{
"status": "OK",
"message": "Weather API is running"
}- New York
- London
- Tokyo
- Sydney
- Paris
- Mumbai
- Toronto
- Berlin
- sunny
- cloudy
- rainy
Each request adds a random temperature variation of ±3°C to simulate dynamic data.