This exercise creates an MVC App that functions as an RSS Feeds client to report GitHub Health information
Model | View | Controller |
---|---|---|
rssReader.js | status.ejs | rssServer.js |
- Node
- Node xml2js
- Node ejs
- Node express
mkdir -p src/views
touch src/rssReader.js
touch src/views/status.ejs
touch src/rssServer.js
npm install express ejs xml2js
<!-- status.ejs -->
<!-- EJS html template to display the GitHub status feed -->
<!-- Each data item will be listed in a table -->
<!-- column: pubDate, title, and link -->
// A javascript class to read RSS feeds parse the data and return it to the client.
// The class
// 1. takes a URL as an argument in the constructor
// 2. fetches the RSS feed data from the provided URL with the method 'fetchFeed()'
// 3. parses the raw XML data into JSON, with the node.js package 'xml2js' in the method 'parseFeed()'
// 3.1. maps the parsed data to the required format: pubDate, title, link and description
// 4. returns the parsed data from the RSS feed with the method 'read()'
// import the required modules
// A Node Express based server App that utilizes the rssReader class
// and its methods to serve RSS feeds to the client.
// The client is the status.ejs file in this directory.
// The server is a simple Express server that listens on port 3000.
// The server has a single route, '/status' which renders and serves
// the 'status.ejs' page using EJS (Embedded JavaScript).
// import the required modules