A Guardian API app made as part of the Makers Academy Software Development course.
The app grabs all the headlines from the Guardian newspaper API and displays them on a page. Clicking on a headline will link the user to the actual article page on the Guardian's website.
Note: this JavaScript program runs solely on the client (frontend) side, within a web browser. All the variables and state in the program are kept in the web browser's memory.
- TDD a Javascript program running in a web browser, using modern JS build tools.
- Use the DOM to manipulate the web page structure and content.
- Use fetch to send HTTP requests to an API.
- Use jest mocking functionality to test drive an API class.
Install dependencies:
; npm install
Open the HTML file in your browser:
# You can run this from your terminal,
# or alternatively double-click on the HTML file
# from the file explorer.
; open index.html
- JavaScript
- Jest
jest-fetch-mock
moduleesbuild
build tool- HTML
- CSS
As a busy politician
So I know what the big stories of the day are
I can see all of today's headlines in one place
As a busy politician
So that I have something nice to look at
I can see a relevant picture to illustrate each news article when I browse headlines
As a busy politician
So I can get a few more details about an important story
I can click a news article title which links to the original article
As a busy politician
So I can search what I want to read about
I can specify a search query on the page and get articles matching this search
Need to register and get an API key to use the Guardian API.
- Guardian newspaper API homepage
- Postman, a program to send and test HTTP requests