Bakend Hosted on vercel
WeatherApp is an application designed to provide weather updates to registered users. The application is built using Node.js and leverages Express.js for its API framework. The app is intended to not only fetch the latest weather information but also send scheduled emails to users.
- Fetch and store weather updates for registered users.
- Update the weather data every hour
- Schedule emails to inform users about the latest weather updates.
- Store user information securely.
- Fetching weather information.
- User registration and authentication.
- Sending scheduled emails.
- Real-time notifications.
- Support for multiple weather data providers.
- Node.js
- Express.js
- MongoDB
- Mongoose
- dotenv
- nodemailer
- node-corn
- openweathermap api
- jsonwebtoken
- bcryptjs
- Custom middlewares for error handling and authentication
- User Registration: Allows new users to register.
- Fetch Weather Updates: Periodically fetch and update weather information for users.
- Scheduled Emails: Send out scheduled emails with weather updates every 3 hours.
- Performance: The application should be able to handle multiple concurrent users.
- Security: Use JWT tokens for user authentication.
- Security: Use bcryptjs to hash the password before storing to the database.
Milestone | Deadline |
---|---|
User Authentication | Done |
Fetch Weather Updates | Done |
Email Scheduling | Done |
- Database Connection Failures: Use connection pooling and retries.
- API Limits for Weather Data: Implement rate limiting and caching.
The WeatherApp aims to keep users informed by providing them with the latest weather updates and sending them scheduled emails.
- Endpoints
Endpoint:
Method: POST
Type: RAW
URL: https://weather-api-dfanso.vercel.app/api/users
Body:
{
"firstName": "DFanso",
"lastName": "Felcianas",
"email": "dfanso@pm.me",
"password": "123@Dfanso",
"location": "Colombo"
}
More example Requests/Responses:
Body:
{
"firstName": "DFanso",
"lastName": "Felcianas",
"email": "dfanso@pm.me",
"password": "123@Dfanso",
"location": "Colombo"
}
{
"message": "User created",
"id": "6501a6cdcc08e4386139ffc0"
}
Status Code: 201
Endpoint:
Method: POST
Type: RAW
URL: https://weather-api-dfanso.vercel.app/api/users/login
Body:
{
"email": "dfanso@pm.me",
"password": "123@Dfanso"
}
More example Requests/Responses:
Body:
{
"email": "dfanso@pm.me",
"password": "123@Dfanso"
}
{
"message": "Logged in",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY1MDFhNmNkY2MwOGU0Mzg2MTM5ZmZjMCIsImVtYWlsIjoiZGZhbnNvQHBtLm1lIiwiaWF0IjoxNjk0NjA3NTQ4LCJleHAiOjE2OTQ2MTExNDh9.XffXGV7XgFa_jImGibB_7dQs9VeUCrER-T8kCz1cHps"
}
Status Code: 200
Endpoint:
Method: GET
Type:
URL: https://weather-api-dfanso.vercel.app/api/users/weather
Headers:
Key | Value | Description |
---|---|---|
Authorization | Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY1MDFhNmNkY2MwOGU0Mzg2MTM5ZmZjMCIsImVtYWlsIjoiZGZhbnNvQHBtLm1lIiwiaWF0IjoxNjk0NjA3MDU2LCJleHAiOjE2OTQ2MTA2NTZ9.0pkJKRWBH_nadjdvJZ1UFAlSPpw805hssA_X5rfaBHA |
More example Requests/Responses:
Headers:
Key | Value | Description |
---|---|---|
Authorization | Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY1MDE1ODRlNWM5OGU1NGViYmFhNWNiNSIsImVtYWlsIjoibGVvZ2F2aW4xMjNAZ21haWwuY29tIiwiaWF0IjoxNjk0NjA4MDQ3LCJleHAiOjE2OTQ2MTE2NDd9.6__-71sO6kU0RTUytVdOqeDkOCA0Fl_J6NlzPno2oFY |
Body: None
{
"location": "Nattandiya",
"weather": {
"temperature": 28,
"weatherDescription": "Rain (light rain)",
"windSpeed": 6.61
}
}
Status Code: 200
Endpoint:
Method: GET
Type:
URL: https://weather-api-dfanso.vercel.app/api/users/weatherByDate/:date
Headers:
Key | Value | Description |
---|---|---|
Authorization | Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY1MDFhNmNkY2MwOGU0Mzg2MTM5ZmZjMCIsImVtYWlsIjoiZGZhbnNvQHBtLm1lIiwiaWF0IjoxNjk0NjA3MDU2LCJleHAiOjE2OTQ2MTA2NTZ9.0pkJKRWBH_nadjdvJZ1UFAlSPpw805hssA_X5rfaBHA |
URL variables:
Key | Value | Description |
---|---|---|
date | 2023-09-15 |
More example Requests/Responses:
Headers:
Key | Value | Description |
---|---|---|
Authorization | Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY1MDFhNmNkY2MwOGU0Mzg2MTM5ZmZjMCIsImVtYWlsIjoiZGZhbnNvQHBtLm1lIiwiaWF0IjoxNjk0NjA3MDU2LCJleHAiOjE2OTQ2MTA2NTZ9.0pkJKRWBH_nadjdvJZ1UFAlSPpw805hssA_X5rfaBHA |
Query:
Key | Value | Description |
---|---|---|
date | 2023-09-15 |
Body: None
{
"dt": 1694736000,
"main": {
"temp": 298.57,
"feels_like": 299.36,
"temp_min": 298.57,
"temp_max": 298.57,
"pressure": 1011,
"sea_level": 1011,
"grnd_level": 1010,
"humidity": 84,
"temp_kf": 0
},
"weather": [
{
"id": 500,
"main": "Rain",
"description": "light rain",
"icon": "10n"
}
],
"clouds": {
"all": 100
},
"wind": {
"speed": 4.2,
"deg": 227,
"gust": 5.75
},
"visibility": 10000,
"pop": 0.81,
"rain": {
"3h": 2.48
},
"sys": {
"pod": "n"
},
"dt_txt": "2023-09-15 00:00:00"
}
Status Code: 200
Endpoint:
Method: PUT
Type: RAW
URL: https://weather-api-dfanso.vercel.app/api/users
Headers:
Key | Value | Description |
---|---|---|
Authorization | Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY1MDFhNmNkY2MwOGU0Mzg2MTM5ZmZjMCIsImVtYWlsIjoiZGZhbnNvQHBtLm1lIiwiaWF0IjoxNjk0NjA3MDU2LCJleHAiOjE2OTQ2MTA2NTZ9.0pkJKRWBH_nadjdvJZ1UFAlSPpw805hssA_X5rfaBHA |
Body:
{
"firstName": "Leo",
"lastName": "Gavin",
"email": "dfanso@pm.me",
"location": "Colombo"
}
More example Requests/Responses:
Headers:
Key | Value | Description |
---|---|---|
Authorization | Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY1MDFhNmNkY2MwOGU0Mzg2MTM5ZmZjMCIsImVtYWlsIjoiZGZhbnNvQHBtLm1lIiwiaWF0IjoxNjk0NjA3MDU2LCJleHAiOjE2OTQ2MTA2NTZ9.0pkJKRWBH_nadjdvJZ1UFAlSPpw805hssA_X5rfaBHA |
Body:
{
"firstName": "Leo",
"lastName": "Gavin",
"email": "dfanso@pm.me",
"location": "Colombo"
}
{
"message": "User updated",
"user": {
"_id": "6501a6cdcc08e4386139ffc0",
"firstName": "Leo",
"lastName": "Gavin",
"email": "dfanso@pm.me",
"password": "$2a$10$UrklruMBDwqHDIGa2PidW.hhNR8LDSgdDNCncWS2cjDbMrQfzF8Cm",
"location": "Colombo",
"__v": 0
}
}
Status Code: 200
Generated at 2023-09-13 by docgen