DailyJS

Node Roundup: Celeri, Strata, Node ACL

2011-09-21 00:00:00 +0100 by Alex R. Young
You can send your node modules and articles in for review through our [contact form](/contact.html) or [@dailyjs](http://twitter.com/dailyjs).

Celeri

Celeri by Craig Condon is a command line library with lots of useful features:

The API is based around events:

var celeri = require('celeri');

celeri.on('hello :name', function(data) {
  console.log('Hello %s!', data.name);
});

celeri.open();
celeri.parse(process.argv);

There are examples available on GitHub that demonstrate the main
features of the library. The API is a lot different to
Commander.js which I posted about recently, but the feature set is slightly different.
However, the Commander.js authors have also written several other
userful CLI libraries (which TJ links to in the Commander.js
documentation).

Strata

Strata (GitHub: mjijackson / strata, License: MIT, npm:
strata) is a Node web framework inspired by WSGI/Rack instead of the popular Connect middleware
framework
. Strata includes a
specification that can be enforced by using the strata.lint middleware.

On the surface Strata looks like Express, but it's actually quite
different:

var strata = require('strata')
  , redirect = strata.redirect
  , app = new strata.Builder;

app.use(strata.commonLogger);
app.use(strata.contentType);
app.use(strata.contentLength);
app.use(strata.sessionCookie);

app.get('/', function(env, callback) {
  callback(200, {}, 'Friends, help! A guinea pig tricked me!');
});

app.get('/redir', function(env, callback) {
  env.session = {};
  redirect(env, callback, '/');
});

module.exports = app;

There's a lively debate about the Strata framework at Hacker
News
.

Node ACL

Node ACL (License: MIT, npm: acl) by Manuel Astudillo is an ACL implementation using Redis. It
includes support for users, roles, hierarchies, resources, and Express
middleware.

Granting administrator privileges might look like this in your
application:

acl = new acl(redisClient);
acl.allow('admin', ['blogs', 'forums'], '*');

Express routes and resources can make use of
acl.middleware():

app.put('/route', acl.middleware(), function(req, res, next) {
});