-
Book Overview & Buying
-
Table Of Contents
Node Cookbook
By :
Many online entities format their response data as JSON and XML in their Application Programmer Interfaces (APIs) to expose pertinent information to third-party developers who can subsequently integrate this data into their applications.
One such online entity is Twitter. In this recipe, we are going to make a command-line application that makes two requests to Twitter's REST service. The first will retrieve the most popular current topics on Twitter and the second will return the most recent tweets regarding the hottest topic on Twitter.
Let's create our file and name it twitter_trends.js. We may also wish to install the third-party colors module to make our output more beautiful:
npm install colors
We'll need the http module in order to make requests, and the colors module to get some color in our console output:
var http = require('http');
var colors = require('colors');
We're going to be making a GET request inside...