MyNews is a news application that fetches the latest news from newsapi.org. It provides users with up-to-date news articles from various sources and categories, ensuring they stay informed about current events.
- Latest News: Get the most recent news articles from around the world.
- Categories: Browse news by different categories such as technology, sports, business, entertainment, and more.
- Search: Search for specific news articles or topics.
- Responsive Design: Accessible on both mobile and desktop devices.
Before you begin, ensure you have met the following requirements:
- You have installed the latest version of Node.js.
- You have an API key from newsapi.org. You can get a free API key by signing up on their website.
-
Clone the repository:
git clone https://github.com/iamnas/mynews.git cd mynews
-
Install the dependencies:
npm install
-
Create a
.env
file in the root directory and add your NewsAPI key:REACT_APP_NEWS_API=your_newsapi_key_here
-
Start the development server:
npm start
Once the development server is running, open your browser and navigate to http://localhost:3000
to start using the application.
The application fetches news from the NewsAPI using the provided API key. It makes GET requests to the API and displays the articles on the homepage. You can browse articles by categories or use the search functionality to find specific news.
The application interacts with the following endpoints of the NewsAPI:
- Top Headlines:
https://newsapi.org/v2/top-headlines
- Everything:
https://newsapi.org/v2/everything
- Sources:
https://newsapi.org/v2/sources
To contribute to MyNews, follow these steps:
-
Fork the repository.
-
Create a new branch:
git checkout -b feature-branch
-
Make your changes and commit them:
git commit -m 'Add some feature'
-
Push to the branch:
git push origin feature-branch
-
Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for more information.