Let's dive right into it by looking at a classic Node problem: counting all Node modules available on npm. The npm registry exposes an HTTP endpoint where we can get the entire contents of the npm registry content as JSON.
Using the command line tool, curl, which is included (or at least installable) on most operating systems, we can try it out.
$ curl https://skimdb.npmjs.com/registry/_changes?include_docs=true
This will print a new line delimited JSON stream of all modules.
The JSON stream returned by the registry contains a JSON object for each module stored on npm followed by a new line character.
A simple Node program that counts all modules could look like this:
var request = require('request')
var npmDb = 'https://skimdb.npmjs.com'
var registryUrl = `${npmDb}/registry/_changes?include_docs=true`
request(registryUrl, function (err...