-
Open terminal in your project directory
-
Clone the repo
git clone https://github.com/arunabharjun/reactjs-news.git
- In your root directory, create a new file with the name ".env" and copy the following in that file
REACT_APP_THEME_KEY = darkMode
REACT_APP_NEWS_API_KEY = <YOUR_API_KEY_HERE>
REACT_APP_NEWS_API = https://newsapi.org/v2
REACT_APP_NEWS_API_ENDPOINT_HEADLINES = top-headlines
REACT_APP_NEWS_API_ENDPOINT_SEARCH = everything
-
Notice the "REACT_APP_NEWS_API_KEY" says <YOUR_API_KEY_HERE>
-
Lets create one.
🔑 Creating your API key from https://newsapi.org/
- If you don't already have an account, visit the following link and create one.
- If you have an account, visit the following link and login
- Then visit the following link
- Copy the "API Key"
- Go back to the root directory and in the ".env" file, replace "<YOUR_API_KEY_HERE>" with the API Key you copied from the previous step.
- Open terminal in the root directory and run the following command
npm install
- Start the react app
npm start
The app should have opened in your default browser, but if it didn't, visit http://localhost:3000/
- View top 10 headlines
- Search news
- Change theme (Dark/Light)
- Custom 404 error page
- Responsive design