The node.js app that ran the Mifflin-Revelry Dashboard app.
In the backend, it uses ntwitter to listen to a public stream of tweets for a list of Mifflin- and Revelry-related search terms and save them in a MongoDB database. In the frontend, it runs a dashboard that connects to the backend and streams tweets with Socket.IO.
The code is (somewhat arbitrarily -- see below) divided into a series of smaller modules inside lib/
:
auth/
: Exports Twitter authentication information. Structure likeindex.js.template
.common/
: Exports objects and functions used in multiple places: The MongoDB collection, the keyword trackers, and theemit_tweet
function used to send tweets to the client.listen/
: Exports thetrack
function for sending the recent tweet history to clients. This is the main communication from the client to the server -- hence, the server "listens".track
takes a socket.io object and a list of trackers as arguments.stream/
: Exportsnew_stream
, the function for opening a connection with the Twitter streaming API and emitting them as tweets to the client.new_stream
takes a socket.io object as its argument.update_herald/
: Exports a function that adds functionality to GET a custom XML file of Herald articles about Mifflin on the/update_herald
endpoint to an Express app given as an argument.