This is a simple news headlines application that integrates with the News API to fetch and display real-time news headlines. The application is built using Vite and React.
- Fetches and displays the latest 5 news headlines.
- Includes news titles, sources, and publication dates.
- Error handling for API request failures with user-friendly messages.
- Uses environment variables to securely manage the API key.
Make sure you have the following installed on your local machine before setting up the project:
Follow these steps to clone, install, and run the project locally:
If you have Git installed, you can clone the repository using the following command:
git clone https://github.com/BP0994/news-app.git
Once the repository is cloned or the ZIP file is extracted, navigate into the project directory:Once the repository is cloned or the ZIP file is extracted, navigate into the project directory:
cd news-headlines-app
Install the required dependencies using npm (or yarn if you prefer):
npm install
Create a .env file in the root directory of the project. Add the following environment variable with your News API key:
VITE_NEWS_API_KEY=your_api_key_here
Replace your_api_key_here with your actual API key from News API.
Start the development server by running the following command:
npm run dev