This is a simple Node.js & Express-based REST API for managing users, updating their location, and retrieving weather reports.
- User Registration & Login with JWT authentication
- Update user location (Country & City)
- Fetch weather data for a given location
- Automatic weather reporting to email for every 3 hours
git clone https://github.com/faizansafwan/weather-reporting.git
cd weather-reporting
touch .env
PORT=5000 MONGO_URI=replace_your_mongodb_connection_string JWT_SECRET=your_secret_key WEATHER_API_KEY=your_openweathermap_api_key
EMAIL_USER=your_email EMAIL_PASS=your_password
POST http://localhost:5000/api/users
{ "name": "John Doe", "email": "johndoe@example.com", "password": "Secure@123", "country": "USA", "city": "New York" }
POST http://localhost:5000/api/users/login
{ "email": "johndoe@example.com", "password": "Secure@123" }
PUT http://localhost:5000/api/users/location/:userid
{ "Authorization": "Bearer your_jwt_token" }
{ "country": "Canada", "city": "Toronto" }
GET http://localhost:5000/api/weather/get-weather?date=YYYY-MM-DD
nodemon server.js