Node Roundup: 0.3.8, node-database-cleaner, node-config

09 Feb 2011 | By Alex Young | Tags node server

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

Node 0.3.8

Node 0.3.8 is out. Here’s the change log with some annotations:

  • Add req.abort() for client side requests
  • Add exception.code for easy testing. For example: if (err.code == 'EADDRINUSE');
  • Add process.stderr
  • require.main is the main module. (Isaac Schlueter)
  • dgram: setMulticastTTL, setMulticastLoopback and addMembership. (Joe Walnes)
  • Fix throttling in TLS connections
  • Add socket.bufferSize
  • MinGW improvements (Bert Belder)
  • Upgrade V8 to 3.1.1

Download: nodejs.org/dist/node-v0.3.8.tar.gz
Website: nodejs.org/docs/v0.3.8
Documentation: nodejs.org/docs/v0.3.8/api

node-database-cleaner

node-database-cleaner (MIT Licensed) by Emerson Macedo knows how to wipe databases. This is useful for writing tests that test against a test database — you might have seen me do something similar in our Node tutorials. It currently works with Mongo.

node-config

node-config (Apache License 2.0) by Loren West is a configuration management library for Node. It can be used to provide consistent access to configuration variables, but also makes it easy to override defaults with values from command-line options or configuration files.

Defining configurations looks like this:

// Customers.js - Customer management utilities

// Configuration parameters and default values
var config = require('config')('Customers', {
  dbHost: 'localhost',
  dbPort: 5984,
  dbName: 'customers',
  syncFrequency: 60
});

Which makes this possible:

$ node billing.js -config smokeTest.js -Customers.dbPort 5985

One useful trick Loren points out in the README is programmatic configuration through argv:

process.argv.push('-Customers.dbPort', 5994);
require('Customers');

blog comments powered by Disqus