Node.js modules you should know about: dnode
catonmat.net
catonmat.net
It uses dnode to essentially let you build an auto-discovering message bus. I recently started using it and so far its been an amazing way to build up small independent services. With almost zero configuration the services can boot up and start talking to each other. It even works in the browser.
Reading the mailing list you can see that hook.io still has some issues to work through: http://groups.google.com/group/hookio
What is it that makes hook.io exciting?
The latest socket.io releases have added a lot of features (node client, rooms, ...) that make libraries like dnode less useful imho.
Quite a nice ecosystem forming just around socket/engine/hooks io's
Would this replace a lot of my ajax calls or... ?
Just write a server.js:
var express = require('express');
var app = express.createServer();
app.use(express.static(__dirname));
app.listen(8080);
console.log('http://localhost:8080/');
// then just pass the server app handle to .listen()!
var dnode = require('dnode');
var server = dnode({
zing : function (n, cb) { cb(n * 100) }
});
server.listen(app);
And whip up an index.html: <html>
<head>
<script src="/dnode.js" type="text/javascript"></script>
<script type="text/javascript">
window.onload = function () {
DNode.connect(function (remote) {
remote.zing(66, function (n) {
document.getElementById('result').innerHTML = n;
});
});
};
</script>
</head>
<body>
n = <span id="result">?</span>
</body>
</html>
Then just run the server.js: $ node server.js
And navigate to http://localhost:8080!Transparent RPC is an anti-pattern, not a benefit. http://news.ycombinator.com/item?id=2318249
Definitely, give dnode a go. It's a lovely piece of software, but keep an eye out for performance issues.
What should I read?
I've read it twice. I suggest doing the examples as you read along with the book, and then improve on them (there is room for improvement in the code architecture).
After that there is a list of other such tutorials here: http://www.readwriteweb.com/hack/2011/04/6-free-e-books-on-n...