Node Roundup: hotcode, fbgraph, browser

19 Oct 2011 | By Alex Young | Tags node modules scraping facebook social

You can send your node modules and articles in for review through our contact form or @dailyjs.


hotcode (License: MIT, npm: hotcode) by Mathias Pettersson is a small Express app that watches for changes on a given path, then reloads an associated app when files change.

To use it, follow the instructions in the project’s README file. When hotcode is run it’ll print out a link to some JavaScript (it should be — this will need to be added to your project to get automatic reloading in the browser.

Projects can be configured in ~/.hotcode so the path doesn’t need to be entered each time hotcode is started. This can be set per-domain as well.

One of the interesting things about hotcode is it can be run against practically any app in any language. If you’re sick of having to restart your app and refresh the browser every time you make a change, then you’re going to love this.


fbgraph (GitHub: criso / fbgraph, License: MIT, npm: fbgraph) by Cristiano Oliveira provides consistent access to the Facebook graph API. According to the author:

All calls will return json. Facebook sometimes decides to just return a string or true or redirects directly to an image.

Given suitable configuration options, people can be authorised using getOauthUrl:

var graph = require('fbgraph')
  , authUrl = graph.getOauthUrl({
      'client_id':    conf.client_id
    , 'redirect_uri': conf.redirect_uri

Once the Facebook dialog has been displayed, graph.authorize is called to complete the process and get the access token.

API calls are made with graph.get or, so most of the API is oriented around HTTP methods:

graph.get('zuck', function(err, res) {
  console.log(res); // { id: '4', name: 'Mark Zuckerberg'... }
}); + '/feed', wallPost, function(err, res) {
  // returns the post id
  console.log(res); // { id: xxxxx}

This is a clean, well-documented, and well-tested Facebook library, which is surprisingly refreshing.


browser (License: MIT, npm: browser) by Shin Suzuki is an event-based library for browsing and scraping URLs, whilst maintaining cookies. Requests are built up using the library’s object, and then triggered with .run():

var $b = require('browser');

Building up a sequence of events is possible with the after method:

var $b = require('browser');


  .after(); // browse after previously registered function


Event callbacks can also be registered:

$b.on('end', function(err, res) {

Now load up jsdom and you’ll be able to scrape faster than you can say “deep-linking lawsuit”!

blog comments powered by Disqus