Node Roundup: npm link, mongoq, EventEmitter

13 Apr 2011 | By Alex Young | Tags node modules mongo npm

npm link

Isaac Schlueter posted about npm link on the Node blog. This is an npm command for use during development — link installing a package will install it using its package.json file, without having to continually rebuild it as you work on it.

The link command has been refactored in npm 1.0, and Isaac explains the thinking behind the new implementation.

mongoq

MongoDB client libraries always seem to be too complicated. Defining schemas might be nice for application code that requires validation and other architectural features, but most of the time I just want to quickly dump or fetch data without thinking about the schema or model classes. I thought that was kind of what NoSQL document-based databases were all about?

So the next time I’m feeling lazy I’m going to try mongoq by zzdhidden. It’s a small MongoDB client library based on node-mongodb-native, and the syntax seems simple enough:

var db = require('mongoq'),
    testdb = db('mongodb://fred:foobar@localhost/testdb');

testdb.collection('people').insert({ name: 'Alex', occupation: 'Wizard' }, function(err, doc) {
  // etc...
});

Notice that it uses the standard connection string, which means you can stick database authentication details in there.

EventEmitter

EventEmitter (MIT/GPL) by Oliver Caldwell is a version of Node’s EventEmitter for browsers. Oliver has written a fair bit of open source client-side JavaScript, including the Spark framework.

If you look at events.js in Node and compare it to EventEmitter.js you can see that they’re similar but Oliver’s version has been somewhat simplified.


blog comments powered by Disqus