In this developer journey we will build a RSS News Feed generator for Trending Topics for the past 24 hours for the entire news in general or a specific industry/category such as (technology and computing or automobile and vehicles, etc.) and subscribe to the feed to get push notifications. This journey explores the use of Discovery Service to get the most trending topics in news or a specific category of news.
Once you are done with this journey you will know how to:
- Built and run server that serves RSS feed with a HTML frontend written in React
- Configure Discovery Service with the App
- Deploy the app to IBM Bluemix using cloudfoundry CLI tool
- Add the RSS feed to your RSS reader and get push notification when new trending topics changes along with news article for it.
This repo contains code for
- Responsive Frontend web application built using React
- Backend Web and RSS Feed Server built using express
- Watson Discovery - Rapidly build a cognitive search and content analytics engine
- Node.js - An asynchronous event driven JavaScript runtime, designed to build scalable applications
- RSS - RSS (Rich Site Summary) is a format for delivering regularly changing web content in our case it will be trending topics
- React - Javascript library for building User Interfaces
- express - Most popular and minimalistic web framework for creating API and Web server
- yarn - Fast, reliable and secure dependency manager for node.js
Make sure before you start you have the following tasks done:
- Install nodejs and yarn
- Install the Cloud-foundry CLI tool
- Have a Bluemix account
Clone the repo by running the following command in the terminal and go into that directory.
$ git clone https://github.com/IBM/watson-discovery-news-trending-topics/
$ cd watson-discovery-news-trending-topics
Install all of the dependencies by running yarn
command. This will install of the node modules specified in the package.json
$ yarn
Then run yarn bootstrap
to copy the .env.sample
to .env
and fill in the credentials in the .env
file by following the next steps.
$ yarn bootstrap
Create the following services:
Fill in name you want to give to your service along with a name where credentials will be saved and click Create.
After the service is created, click on Service credentials and then click on View Credentials and copy the username and password values into the .env
after the =
sign for DISCOVERY_SERVICE_USERNAME
and DISCOVERY_SERVICE_PASSWORD
environment variables.
Start the app by running yarn start
. If you are developing and making changes to the app and would like the server to restart every time then run yarn start:watch
$ yarn start
Open the browser and go to http://localhost:3333
To deploy to Bluemix make sure you have cloud foundry CLI tool installed. Then run the following commands to connect it with Bluemix and login with your Bluemix credentials.
$ cf api https://api.ng.bluemix.net
$ cf login
Then to deploy just run the following command and it will push the code, deploy it to a server and run it.
$ cf push
Go to the URL that is printed at the end after deployment is done and you can view the app in the browser and copy the RSS link to your favorite RSS Reader. If your RSS Feed Reader supports push notifications you can get alerted when trending topics change along with a news article for that topic.
Since RSS feed is a standard way to consume constantly changing data such as news, we can use the RSS feeds we generated to also post news articles to your organizations slack channel to track trends in your industry, or consume the feed to generate a dialy digest of news and email in the morning. Other uses may include automaticaly posting tweets to a twitter account on news articles on trending topics using a service called IFTTT.