NYT Article Search Website

Personal Project

Main Languages Used:
JavaScript, HTML, CSS, React.js

Date Completed
November 2022

Created an interactive website using React.js which draws from the public New York Times API.

The user has the option to select the most emailed, shared, or viewed articles of the week from the New York Times. The 20 most popular articles from that criteria are then loaded, with each article having a small preview as well as a hyperlink to the article itself.

The website was built and run using React.js. The website has 3 foundational components; the search bar, a list of news articles, and an individual news article. Each component has a corresponding JavaScript and CSS file to handle its logic and  appearance.

There is also a JavaScript file, NTY.js, which handles the main logic of making calls to the New York TImes API. The calls are made to an endpoint which sends back the most popular articles of the week based on the criteria given. The following data are extracted from each article:

  • Article ID
  • Title
  • Byline
  • Section
  • Date Published
  • URL

The relevant data are then either stored in memory to be used later, or displayed on the screen.

SearchBar.js is an example of a JavaScript file. 

The file handles the logic for when a new search is entered, or when the user changes the selection for whether they want the most viewed, shared, or emailed articles of the week. In each case, a new call to the NYT API is initiated and the page loads accordingly.

Article.css is an example of a CSS file.

The file specifies the formatting for each individual article on the screen. The file imports a font from a public API of fonts provided by Google.

The NTY.js file pictured to the right makes calls to the New York Times API. 


The category of articles being searched for is entered as a parameter to the "search" function which then sends the request.


The API key is stored as a constant. Any errors that are thrown when attempting to fetch articles are caught and logged to the console.





The image to the left shows some of the most viewed New York Times articles of the week loaded into the website. Screenshot was taken on March 6, 2023.

Create your website for free! This website was made with Webnode. Create your own for free today! Get started