This article rounds up what is available on the internet right now for getting started with Node.js, and includes a gem at the beginning a special recommendation at the end.
- Ryan Dahl’s 2009 presentation of Node.js at JSConf 2009
As cited in the Node.js mailing list, this gem is still best single intro to the concepts, architecture and general overview of Node.js despite the passing of two years (a long time in SSJS land!).
- 7 Free E-Books and Tutorials for Learning and Mastering Node.js lists several sources, and I will outline a general description of each below.
- edit (best dive in deep free resource): The “Let’s make a web app” series of articles and accompanying github repo commits conforming the Nodepad editor project (built on Node.js, Express.js and MongoDB) on the dailyjs.com blog, written by Alex Young. Continually updated by Alex as different versions of node, npm, etc. emerge, it will “walk you through building a web app with Node, covering all the major areas you’ll need to face when building your own applications.”
- edit (deserves special mention): Hands-on Node.js http://nodetuts.com/handson-nodejs-book.html
You can download the first 60 pages of this $3.99 book for free. My verdict: looks like it actually gives devs what they need to start building applications. Will write review after working with it.
- edit: http://www.ibm.com/developerworks/cloud/library/cl-nodejscloud/
The seven learning sources cited above and itemized below are all great and a must go to, not to read of course but also for working through the code and running everything. And we’ll save the best gem for last.
Here are the seven resources:
- The Node.js site itself! http://nodejs.org/
You got your six-line web server, your recent screencast, your latest stable API docs (0.4.8 at the time of this writing – the docs are always available from the left-hand menu), the wiki, the blog, the demo,… jump right in.
To run the demo:
$ git clone https://github.com/ry/node_chat.git
$ cd node_chat
$ node server.js
Point your browser at http://127.0.0.1:8001/
- Mastering Node http://visionmedia.github.com/masteringnode/
I think this work in progress (all books on Node.js really have to be a work-in-progress: it’s a fiercely moving target!), being close to the source and authoritatively written, explains a host of things you really need to get under your belt. You get a really good explanation complete with usage examples on the CommonJS Module System, a framework used pervasively in Node.js development (you can’t work with the code without understanding it, just as you can’t without understanding the role of non-blocking callbacks in the event loop explained in the preceding resources); as well as on important globals like console and process; Events and EventEmitter; Buffers and Streams; more is promised but this gets you off to a good start.
- The much touted O’Reilly book:
- The Node Beginner Book http://nodebeginner.org/
A cool journey well worth following, many will profit by reading and working along with the code. Many very useful links along the way.
- As the article says, “Bulletproof Node.js Coding is a concise but helpful collection of tips for Node.js programmers.”. I believe author Stella Laurenzo is in a place many of us will be finding ourselves in shortly “I’ve been actively doing node.js coding for about 4 months now. I’m working with a couple of others on a suite of mobile apps and my time has been split between building the Android client (one of my partners drew the long straw and got ios for this round) and building out the node.js based backend. It’s currently a Node.js + CouchDB + Redis server that combines user auth/account management with real-time signalling between connected clients.” and Stella shares! After all this book larnin’ I hope to be also. Interesting discussion of Promises and FuturesJS and functional coding.
It’s been a pedagogic joy working through this chapter of a great book! Look at this:
If you can get a copy of the book, do so. You can get print, kindle and/or PDF from the book’s website: http://tddjs.com/ Then jump into Chapter 14. What the author has done is to create an “initial state” of the code for each chapter, so you can follow along entering additional code as you work through the chapter. Even better, a git repo of the code from each chapter is provided, with commits corresponding to each step. Following instructions at http://tddjs.com/code, I grabbed the code for Chapter 14:
I then created a branch so I could play with the actual initial state of the code, corresponding to the first commit
$ git checkout -b step 01 96c9f042
What I got here was the author’s forked version of nodeunit in the ./deps directory. A test case class is added. It’s all explained, actually, with examples and everything, on Christian Johansen’s blog: http://cjohansen.no/en/node_js/unit_testing_node_js_apps
When I was ready for, say, step six, I just did:
$ git checkout -b step06 816dbab473
and examined and ran the code.
I was also able to browse through each of the committed steps using GitX on Mac, or gitk on Ubuntu.