NewsApp

Introduction

This tutorial will help you build a simple online news application, The Daily Broadcast, that fetches current news from various sources once every hour, and displays the results.

This application uses a third-party service, NewsAPI, that provides real-time global news headlines from all over the web. We will integrate the simple API they provide to fetch news in our news application.

The latest headlines in the following news categories will be displayed in the app with links to the original articles: Business, Entertainment, Health, Science, Sports, Technology.


The client application will look like this:

cron_app_view


You can access a working application and test its functioning here: news-fetcher.catalystserverlessapp.com/app/

The news application contains the following fundamental Catalyst components:

  • Cron Function: The Cron function can be coded in the Java or Node.js platform. It makes API calls to NewsAPI to fetch news and populates the data in the Data Store.

  • Advanced I/O Function: The Advanced I/O function can be coded in either Java or Node.js platform. It contains the API that fetches data from the Data Store and passes it on to the client as a JSON response.

  • Client: The front end of the application that is hosted on Catalyst through web client hosting.


The news application uses the following Catalyst features:

  • Cron: To automatically initiate the execution of the cron function once every hour, enabling it to fetch news from NewsAPI.

  • Data Store: To store the news items of various categories in individual tables.

  • ZCQL: To fetch data from the Data Store through querying.

We will use the Catalyst web console and the Catalyst Command Line Interface (CLI) to build this application.

You will be given the code for the files to be included in the function and client components in this tutorial. You will just need to copy the provided code and paste it into the appropriate files as directed.


Application Architecture

The application architecture is depicted below:

cron_architecture

Last Updated 2024-06-18 12:08:24 +0530 +0530

Min Time to Complete:

30 mins

Difficulty Level:

Intermediate

SERVICES INVOLVED

Serverless Cloud Scale

COMPONENTS INVOLVED

Functions Web Client Data Store Cron ZCQL