Node Roundup: cli, Mongolia, node-openid

2011-01-12 00:00:00 +0000 by Alex R. Young

Welcome to the Node Roundup. Send in your apps and libraries using our
contact form or @dailyjs.


cli (MIT License) by Chris O'Hara is a library for rapidly building Node command line applications. It includes
an argument parser, plugin support for adding common options, helper
methods to make it easier to work with IO and child processes, colours,
progress bars, and auto-completion.

It's on npm so it's easily installed with npm install cli.

One of the examples is for sorting a file's contents:

var cli = require('cli'), options = cli.parse();

cli.withStdinLines(function(lines, newline) {
    lines.sort(!options.n ? null : function(a, b) {
        return parseInt(a) > parseInt(b);
    if (options.r) lines.reverse();

This supports -r and -n.


Mongolia by Pau Ramon Revilla is a wrapper for MongoDB with minimal magic. The examples the author gives
use simple prototype classes:

var Post = function(db) {
  return Model(db, 'posts');

var Post = Post(db);

Post.createInstance({ title: 'This is a post' }, function(error, validator) {
  // Check validator if set up

The API includes methods for embedded objects and validation, so it
should provide more bang for buck than the native driver.

It's also worth pointing out that Mongoose's 1.0
looks simpler than
the old one, introducing a new chaining-based API.


node-openid (MIT License) by HÃ¥vard Stranden looks like a great library for OpenID. It supports
OpenID 1.1/OpenID 2.0, has a very simple API, and seems much easier to
use than the other OpenID libraries I've tried.

If you plan on using this library, note that:

To provide a way to save/load association state, you need to mix-in two functions in the openid module (saveAssociation, loadAssociation) ... The openid module includes default implementations for these functions using a simple object to store the associations in-memory.

That means the callbacks could be replaced with custom callbacks to save
to your favourite SQL or NoSQL databases.

The author has written a blog post about the project here: OpenID for