Welcome to the Weather App, a simple web application for checking the weather forecast of different locations.
Make sure you have the following installed before setting up the project:
- Node.js
- MongoDB
-
Clone the repository:
git clone https://github.com/your-username/weather-app.git cd weather-app
-
Navigate to the backend and frontend directories separately:
cd backend_server/ cd frontend_app/
-
Install the required npm packages:
npm install
To obtain a Weather API key, visit WeatherAPI and follow the instructions to create an account.
-
Navigate to the backend folder:
cd backend_server/
-
Generate your Weather API key from the link provided in the above section.
-
Create a
.env
file in the root of the backend folder with the following content:WEATHER_API_KEY=your-weather-api-key MONGODB_URI=your-mongodb-uri PORT=your-port
-
Start the backend server:
nodemon
-
Ensure that the backend server is up and running.
-
Navigate to the frontend folder:
cd frontend_app/
-
Start the frontend application:
npm run dev
-
Open your browser and go to the URL provided in the terminal.
-
Ensure that the backend server is running.
-
Use API tools like Postman to add locations. Send a POST request to http://localhost:{your-port}/api/locations with the location details in the request body.
Example JSON payload:
{ "name": "CityName", "latitude": 123.456, "longitude": 789.012 }