Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jamessembukuttiarachchi/weather-api-nodejs
Node.js API that stores users’ emails and location, and automatically sends hourly weather reports every 3 hours.
https://github.com/jamessembukuttiarachchi/weather-api-nodejs
Last synced: 26 days ago
JSON representation
Node.js API that stores users’ emails and location, and automatically sends hourly weather reports every 3 hours.
- Host: GitHub
- URL: https://github.com/jamessembukuttiarachchi/weather-api-nodejs
- Owner: JamesSembukuttiarachchi
- Created: 2024-07-12T05:16:34.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-07-13T09:17:45.000Z (7 months ago)
- Last Synced: 2024-11-07T23:15:00.781Z (3 months ago)
- Language: JavaScript
- Size: 4.25 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Weather App
## Overview
This Node.js backend application stores users' emails and locations and automatically sends hourly weather reports every 3 hours. It uses MongoDB for data storage and the OpenWeatherMap API to fetch weather data.
## Features
- User registration and login with JWT authentication
- Store and update user details (email, location)
- Send hourly weather reports every 3 hours via email
- Retrieve user's weather data for a given day## Technologies Used
- Node.js
- Express.js
- MongoDB (Mongoose)
- OpenWeatherMap API
- Nodemailer
- JWT (jsonwebtoken)
- Cron jobs (node-cron)## Getting Started
### Prerequisites
- Node.js
- MongoDB
- Postman (for testing the API)### Installation
1. **Clone the repository**:
```bash
git clone https://github.com/your-username/weather-app.git
cd weather-app2. **Install the dependencies**:
```bash
npm install
3. **Create a .env file in the root directory and add the following environment variables**
```text
PORT=3000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
OPENWEATHERMAP_API_KEY=your_openweathermap_api_key
EMAIL_SERVICE=your_email_service
EMAIL_USER=your_email_user
EMAIL_PASS=your_email_password4. **Start the Server**:
```bash
npm start5. **API Endpoints**
```json
{
"email": "[email protected]",
"password": "password",
"location": {
"latitude": 12.34,
"longitude": 56.78
}
}
{
"latitude": 12.34,
"longitude": 56.78
}