substack/dnode — pull request #116 by rngadam (2012-11-05 20:58:27+00:00)
Title: Accept a port of value zero

This lets the operating system select the port to listen to.

To figure out which port to use, call the method address()
on the returned server.

Also fix some trailing whitespaces.

Usage example:

```
ss.http.middleware.prepend('/dnode', function(req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
var parsed = require('url').parse(req.url, true);
if(parsed.query.require) {
var dnode = require('dnode');
var lib = require(parsed.query.require);
var server = dnode(lib);
var httpServer = server.listen(0);
res.end('' + httpServer.address().port);
}
});
```