3 Node Frameworks

2009-12-03 00:00:00 +0000 by Alex R. Young

The floodgates have opened on node.js web app
frameworks. The best ones that I've found so far are micro-frameworks,
using Sinatra inspired API designs. Some
are more ambitious.

Picard uses haml-js and looks like this:


get('/', function(){
  return { text: 'Hello Universe' }

There's an interesting benchmark claim in the documentation:

The included sinatra\_app\_for\_benchmarks is a Ruby port of the Picard sample\_app. According to these benchmarks, the Picard app on node.js runs about twice as fast as the Sinatra app on Thin and can handle around 12x as many requests per second (due to the asynchronous nature of node.js).

The library comes with a sample app.

Bomber is more similar to Rails or Django. It currently has a router and views. Router definitions look like this:

var Router = require('bomber/lib/router').Router;
var r = new Router();


exports.router = r;

And views look like this:

exports.show = function(request, response) {
  if( request.format == 'json' ) {
    return {a: 1, b: 'two', c: { value: 'three'}};
  else {
    return "show action";

Meanwhile, Campy is a
Camping-inspired framework. Campy uses a modified version of
MooTools. The author is trying to take what Camping offered yet retain a JavaScriptic approach.

We also recently featured
Express, which is super-simple and very clean. It's Sinatra-inspired, and the author has lots of
interesting JavaScript projects on GitHub so it's one to keep an eye on
(and contribute to!)