3 Node Frameworks

03 Dec 2009 | By Alex Young | Tags nodejs server

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:

require('./config/env')

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();

r.add('/:view/:action/:id');
r.add('/:view/:action');

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!)

blog comments powered by Disqus