Sunday, February 13, 2011

NodeJS- Useful Modules

1. express (RESTful routing, http://expressjs.com/ )
http://expressjs.com/guide.html

High performance, high class web development for Node.js

 var express = require('express');
var app = express.createServer();
app.get('/', function(req, res){
res.send('Hello World');
});
app.listen(3000);

Features
  • Robust routing
  • Redirection helpers
  • Dynamic view helpers
  • Application level view options
  • Content negotiation
  • Focus on high performance
  • View rendering and partials support
  • Environment based configuration
  • Session based flash notifications
  • Built on Connect
  • Executable for generating applications quickly
  • High test coverage




2. socket.io (Websocket)
http://soohwan.blogspot.com/2011/02/nodejs-socketio.html

3. couch_client (CouchDB)

4. node_redis (redis)

5. mDNS/Zeroconf/Bonjour (https://github.com/agnat/node_mdns)
Hmm unfortunately this is not useable in my Appliance, so I gave up to use this even though I need this feature.

 npm install mdns 



Service Discovery

node_mdns – service discovery for node.js
node_mdns adds support for multicast DNS service discovery, also known as zeroconf or bonjour to node.js. It provides an object-oriented interface to announce and browse services on the local network.

Internally, it uses the mDNSResponder API which is available on all major platforms.

On Linux and other systems using the avahi daemon the avahi dns_sd compat library and its header files are required.

 var mdns = require('mdns'); 
// Browser.
var browser = mdns.createBrowser('http');
browser.on('serviceUp', function(info, flags) {
console.log("up");
console.dir(info);
});
browser.on('serviceDown', function(info, flags) {
console.log("down");
console.dir(info);
});
browser.on('serviceChanged', function(info, flags) {
console.log("changed");
console.dir(info);
});
browser.start();
// Advertisement.
// mdns.createAdvertisement('http', 4321).start();


6. msgpack (gave up because it is hard to compile in my centos/mac)
A space-efficient object serialization library for NodeJS

No comments: