This is a Node.js API that stores users' emails and locations, and automatically sends weather reports every 3 hours. It uses the OpenWeatherMap API to fetch weather data and Nodemailer to send email reports.
- Node.js
- MongoDB (You can use MongoDB Atlas for a cloud-based solution)
- Git
- Clone the repository:
git clone https://github.com/dilusha07/weather_app.git
- Navigate to the project directory.
- Run
npm install
to install dependencies. - Configure your environment variables in a config.json file
- Start the server using
npm start
.
- POST /users - Store user details (email and location).
- PUT /users/:email - Update user's location.
- GET /users/:email/weather - Retrieve user's weather data for a given day.
- GET /weather - Fetch weather data for a specified city.
- DELETE /users/:email - Delete a user by email.
- POST /users/send-weather-report/:email - Trigger sending weather report email.
- Test the routes using Postman
- Deploy on Vercel
- Install Elastic Beanstalk CLI:
pip install awsebcli
- Initialize the Application:
eb init -p node.js weather_app
- Create an Environment:
eb create weather-app-env
- Deploy the Application:
eb deploy