Skip to content

saurabh2774/task2-weather-app-using-mern

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TASK2)weather application -using mern company: CODTECH IT SOLUTIONS PVT.LTD NAME: Saurabh Chikte Intern Id: :CT08IEO DOMAIN: Mern Stack Web Development BATCH DURATION: :30/12/2024 to 30/01/2025 MENTOR NAME: Neela Santhosh Kumar


TASK DESCRIPTION-- > Task Description: Weather Application Using MERN Stack Overview The goal of this task is to build a weather forecasting web application using the MERN stack (MongoDB, Express.js, React.js, and Node.js). The application will allow users to enter a city name and view the current weather conditions, including temperature, humidity, wind speed, and a weather icon. The weather data will be fetched from a third-party API (like OpenWeatherMap) and presented in a clean and user-friendly interface.

Features

  1. Search for Weather by City:
    Users should be able to enter the name of a city and fetch its current weather details.

  2. Display Weather Information:
    Once the user inputs a city, the application will display the following weather details:

    • Temperature (in Celsius or Fahrenheit)
    • Weather condition (e.g., sunny, rainy, cloudy)
    • Wind speed
    • Humidity
    • Weather icon (based on the condition, fetched from the weather API)
  3. API Integration:
    The application should integrate with a weather API, such as OpenWeatherMap or WeatherAPI, to retrieve real-time weather data.

  4. Responsive Design:
    The application should be fully responsive, ensuring it works well on both desktop and mobile devices.

  5. Error Handling:
    If a user enters an invalid city or if the weather API fails, the application should display an appropriate error message.

  6. User-friendly UI/UX:
    The user interface should be simple, clean, and easy to use. The design should display all relevant weather data clearly.

  7. Location-based Weather (optional):
    Optionally, you can implement geolocation features to fetch the weather data of the user's current location using the browser's Geolocation API.

  8. Weather History (optional):
    Save the search history of previously searched cities in the backend, so users can see their past searches.

Technology Stack

  1. Frontend (React.js):

    • React.js: For building the user interface.
    • Axios or Fetch API: For making HTTP requests to the weather API.
    • React Router: For handling page routing (if applicable).
    • CSS/Bootstrap: For styling the application and ensuring it's responsive.
  2. Backend (Node.js + Express.js):

    • Node.js: The runtime environment for building the backend.
    • Express.js: A web application framework for building the server-side functionality.
    • API calls: Use Express to create an endpoint that fetches weather data from the third-party weather API.
    • MongoDB (Optional): Store search history, user preferences, or other data (e.g., past weather searches).
  3. Weather API Integration:

    • Use an external weather API (e.g., OpenWeatherMap API or WeatherAPI) to fetch real-time weather information based on city names or geolocation.
  4. MongoDB (Optional):

    • If storing search history or user preferences, use MongoDB for database management. Each search can be saved as a record in MongoDB with the city name and weather data.
  5. Version Control:

    • Use Git for version control and store your code on GitHub or any other repository hosting service.

Steps to Complete the Task

  1. Set up the Backend:

    • Initialize a Node.js project and install necessary dependencies (Express, Axios, etc.).
    • Set up the Express server and create an API endpoint that queries the weather API with the city name provided by the user.
    • Handle errors and edge cases (invalid city names, API errors).
  2. Set up the Frontend:

    • Create a React app using create-react-app or your preferred method.
    • Implement the search functionality (input field for city name).
    • Display the weather data received from the backend (temperature, humidity, wind speed, weather description, and icon).
  3. Connect Backend and Frontend:

    • Use Axios or Fetch to call the Express API endpoint from the frontend and display the data in the UI.
    • Handle loading states and error messages.
  4. Add Styling:

    • Make sure the app is styled properly, responsive, and user-friendly.
    • Use CSS frameworks like Bootstrap or Material-UI for faster development.
  5. Optional Features:

    • Implement geolocation-based weather data.
    • Store the search history in MongoDB.
    • Add user authentication (if required) to save user preferences.
  6. Testing and Debugging:

    • Test the application to ensure everything works as expected.
    • Debug any issues, handle edge cases, and ensure proper error handling.
  7. Deploy the Application:

    • Once the application is ready, deploy it to platforms like Heroku, Vercel, or Netlify for the frontend and backend.

Deliverables

  • Source code for the frontend (React.js) and backend (Node.js + Express.js).
  • A working weather application hosted on a platform (e.g., Heroku, Netlify).
  • Documentation (README) outlining how to run and use the application.
  • Optional: Database integration if you implemented search history functionality.

CONCLUSION:) This project will help you get hands-on experience with the MERN stack while building a practical and useful application.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages