DailyJS

Node Roundup: Windows Performance Boost, Bricks.js, Commander.js

Alex R. Young

Subscribe

@dailyjs

Facebook

Google+

frameworks cli node modules windows

Node Roundup: Windows Performance Boost, Bricks.js, Commander.js

Posted by Alex R. Young on .
Featured

frameworks cli node modules windows

Node Roundup: Windows Performance Boost, Bricks.js, Commander.js

Posted by Alex R. Young on .
You can send your node modules and articles in for review through our [contact form](/contact.html) or [@dailyjs](http://twitter.com/dailyjs).

Windows Performance Boost

I noticed Ryan Dahl post a link to these Node http_simple
benchmarks
on Twitter:

nodejs v0.5 benchmarks gist.github.com/1166690 (still some work to do on libuv backend but Windows is on par with Linux now!)

This is good news for Windows developers, and again demonstrates the
phenomenal progress we're seeing on libuv.

Bricks.js

Bricks.js (GitHub: JerrySievert / bricks, License: MIT/X11,
npm: bricks) by Jerry Sievert is a modular web framework that isn't
built on existing web technology like
Connect.

The most basic usage example is a static web server:

var bricks = require('bricks');
var appServer = new bricks.appserver();

appServer.addRoute('/static/.+', appServer.plugins.filehandler, { basedir: './static' });
appServer.addRoute('.+', appServer.plugins.fourohfour);
var server appServer.createServer();

server.listen(3000);

Routes can be strings or regular expressions. Routes are grouped into
sections, which are pre, main,
post, and final. Each of these sections are
explained in the Bricks.js
documentation
.

When a function is passed to a route, it gets request,
response
parameters like Express. Routes can also take plugins,
which can be used to manage state. The routing and error APIs are
event-based. That means it's possible to set up listeners on events like
section completion and errors:

response.on('main.complete', mainCompletion);

// Errors
appserver.addEventHandler('route.fatal', function(error) { console.log('FATAL:', error); });

Bricks.js seems to be quite different to most Node web frameworks, and I
like the fact it's event-based. It seems like the strength of the
framework will come from contributed plugins, so hopefully Jerry will
start some kind of centralised list of plugins as they emerge.

Commander.js

Commander.js (GitHub: visionmedia / commander.js, License:
MIT, npm: commander) by TJ Holowaychuk is a "complete solution" for developing command-line interfaces.

It has a chained API, allowing you to express a command-line application
in terms of options, prompts (including a non-echoing password prompt),
confirmation, and simple menus. This allows command-line help to be
automatically generated.

program
  .version('0.0.1')
  .option('-i, --integer ', 'An integer argument', parseInt)
  .option('-f, --float ', 'A float argument', parseFloat)
  .option('-r, --range ..', 'A range', range)
  .option('-l, --list ', 'A list', list)
  .option('-o, --optional [value]', 'An optional value')
  .parse(process.argv);