-
Open terminal in your project directory
-
Clone the repo
git clone https://github.com/arunabharjun/articles-app.git
- In your root directory, create a new file with the name "next.config.js" and copy the following in that file
module.exports = {
env: {
API: 'https://api.nytimes.com/svc/search/v2',
API_KEY: 'YOUR_API_KEY_HERE',
IMAGE_API: ' https://static01.nyt.com',
SEARCH_ENDPOINT: 'articlesearch.json',
DEFAULT_QUERY: 'india',
APP_NAME: 'Articles App'
}
};
-
Notice the API_KEY says YOUR_API_KEY_HERE
-
Lets create one.
🔑 Creating your API key from https://developer.nytimes.com/apis
-
If you don't already have an account, visit the following link and create one. Register - NYT API
-
If you have an account, visit the following link and login. Login - NYT API
-
Then visit the following link to create a new app. New APP - NYT API
-
Fill in all the details as asked
-
In the same page, under APIs section, for the 'Article Search API', click on the plus (+) sign against it and see the status change (Should say 'Active')
-
Then press the 'CREATE' button to get the API key.
-
Visit the following link and you will see you app listed there if the app was successfully created. APP List - NYT API
-
Find your app in that list and click on it.
-
In that page, you will see 'API Keys', copy the value against 'Key'.
- Go back to the root directory and in the "next.config.js" 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 Next.js app
npm run dev
Visit http://localhost:3000/ to view the app.
- Browse latest articles from NYT
- Has infinite scrolling
- Respponsive design
- Modern UI