Explore Node’s unique approach to asynchronous development
Build sample Node applications with the Express framework and Connect middleware
Use NoSQL solutions such as Redis and MongoDB—and explore Node’s relational database modules
Work with PDF files, serve HTML5 media, and create graphics with Canvas
Set up bidirectional communication between browser and server with WebSockets
Learn in-depth practices for debugging and testing your applications
Deploy Node applications in the cloud or on your own system
"Learning Node will make it easy for someone from any programming background to get a grip on Node.js and build amazing projects."
—Tom Hughes-Croucher, co-author of Node: Up and Running (O’Reilly)
Chapter 1 Node.js: Up and Running
Setting Up a Node Development Environment
Node: Jumping In
Asynchronous Functions and the Node Event Loop
Benefits of Node
Chapter 2 Interactive Node with REPL
REPL: First Looks and Undefined Expressions
Stuff Happens—Save Often
Chapter 3 The Node Core
Globals: global, process, and Buffer
The Timers: setTimeout, clearTimeout, setInterval, and clearInterval
Servers, Streams, and Sockets
Domain Resolution and URL Processing
The Utilities Module and Object Inheritance
Events and EventEmitter
Chapter 4 The Node Module System
Loading a Module with require and Default Paths
External Modules and the Node Package Manager
Creating Your Own Custom Module
Chapter 5 Control Flow, Asynchronous Patterns, and Exception Handling
Promises, No Promises, Callback Instead
Sequential Functionality, Nested Callbacks, and Exception Handling
Asynchronous Patterns and Control Flow Modules
Chapter 6 Routing Traffic, Serving Files, and Middleware
Building a Simple Static File Server from Scratch
Chapter 7 The Express Framework
Express: Up and Running
The app.js File in More Detail
A Closer Look at the Express/Connect Partnership
Cue the MVC
Testing the Express Application with cURL
Chapter 8 Express, Template Systems, and CSS
Using a Template System (EJS) with Express
The Jade Template System
Incorporating Stylus for Simplified CSS
Chapter 9 Structured Data with Node and Redis
Getting Started with Node and Redis
Building a Game Leaderboard
Creating a Message Queue
Adding a Stats Middleware to an Express Application
Chapter 10 Node and MongoDB: Document-Centric Data
The MongoDB Native Node.js Driver
Implementing a Widget Model with Mongoose
Chapter 11 The Node Relational Database Bindings
Getting Started with db-mysql
ORM Support with Sequelize
Chapter 12 Graphics and HTML5 Video
Creating and Working with PDFs
Accessing ImageMagick from a Child Process
Properly Serving HTML5 Video with HTTP
Creating and Streaming Canvas Content
Chapter 13 WebSockets and Socket.IO
An Introduction to Socket.IO
Chat: The WebSockets “Hello, World”
Using Socket.IO with Express
Chapter 14 Testing and Debugging Node Applications
Performance Testing: Benchmarks and Load Tests
Refreshing Code with Nodemon
Chapter 15 Guards at the Gate
Authentication/Authorization with Passport
Protecting Applications and Preventing Attacks
Chapter 16 Scaling and Deploying Node Applications
The animal on the cover of Learning Node is a hamster rat (Beamys). There are twospecies of hamster rats: the greater hamster rat (Beamys major) and the lesser hamsterrat (Beamys hindei).The hamster rat inhabits the African forests from Kenya to Tanzania. This large rodentprefers to make its home in moist environments: along riverbanks and in thickly-forestedareas. It thrives in coastal or mountainous regions, although deforestation threatensits natural habitat. Hamster rats live in multichambered burrows and are excellentclimbers.This rodent has a very distinct appearance: it can be 7 to 12 inches long and weigh upto a third of a pound. It has a short head and gray fur overall, with a white belly and amottled black and white tail. The hamster rat, like other rodents, has a variable diet; itpossesses cheek pouches for food storage.The cover image is from Shaw’s Zoology. The cover font is Adobe ITC Garamond. Thetext font is Linotype Birka; the heading font is Adobe Myriad Condensed; and the codefont is LucasFont’s TheSansMonoCondensed.
I'll briefly delve into things that stood out to me in each chapter of the book.
Chapter 1 – Reading this chapter is a must if you don't understand the asynchronous nature of Node. It also covers building it from source for Linux, and using WebMatrix to develop and run Node applications with IIS.
Chapter 2 – Shows how to use command line REPL (read-eval-print loop) to quickly test code, inspect objects, and as an editor. Imagine that!
Chapter 3 – Covers the Node core objects and modules. In particular, the global namespace object, process.nextTick to asynchronously execute a callback, util.inherits to implement inheritance, and EventEmitter to emit events.
Chapter 4 – Covers the Node module system. Covers require and how it searches for modules (.js, .node or .json), delete require.cache to reload a module from source, how to create your own custom module, and expose its objects and functions using export. It also covers often used modules such as npm (installed with Node) for package management, Optimist for options parsing, and Underscore.
Chapter 5 – Delves deeper into the asynchronous nature of Node, covering control flow, exception handling, and asynchronous patterns. It then discusses the Step and Async modules that implement those patterns. It also briefly discusses Node coding style.
Chapters 6, 7, 8 – Discuss web development middleware and frameworks such as Connect and Express, and templating modules that work in tandem with Express, such as EJS and Jade.
Chapter 9, 10, 11 -Discuss the different means of persisting data, in a key-value store such as Redis, document-centric database such as MongoDB, or a relational database such as MySQL, either directly or using the Sequelize ORM.
Chapter 12 – Discusses manipulating PDF by executing external tools such as PDF Toolkit, creating drawings using the canvas module, and streaming videos.
Chapter 13 – Discusses the popular Socket.IO library that you can leverage for bidirectional communication between server and the Browser.
Chapter 14 – Discusses unit testing, acceptance testing, and performance testing. Tools and modules covered include Apache Bench (ab), nodeunit, Selenium, and soda. Also discussed is the nodemon module that can be used to restart the application when a script is changed.
Chapter 15 – Discusses TLS/SSL, HTTPS for securing data communication, saving password as hash using the crypto module, authentication using the passport module, and authentication with Twitter using the passport-twitter Passport strategy module. It also discusses writing secure code by avoiding eval, validating data using a module such as node-validator, and running external scripts in a sandbox using the vm module.
Chapter 16 – Discusses deployment of applications to a server, or to the various cloud services such as Azure (using Cloud9 IDE), Joyent, Heroku, Amazon EC2, and Nodejitsu. It discusses modules such as Forever to recover from crashes, and integration with Apache. The discussion on clustering with Node is very brief and does not discuss the experimental cluster module.
I am glad the author took the time to write this book, I am a better "Noder" because of it. I'd like to thank O'Reilly Media for giving me the opportunity to review this book as part of the blogger review program.
Bottom Line Yes, I would recommend this to a friend
The really good: The writing style and content hits all three major points I look for in a development instruction book; Concise - the author gets right to the point explaining the most relevant details about the topic at hand, Code-Centric - explanations are paired with functional code demonstrating the topic, and Thorough - the book in its entirety covers all of the topics I expect it to and more. Overall, I would recommend this book without reservation to any developer looking to get a handle on Node in a hands-on way.
The somewhat less good: I didn't love the choice of MongoDB for the NoSQL section (would have preferred Couch or somethig else), but I understand the decision (author says it was much faster to explain Mongo than Couch).
Bottom Line Yes, I would recommend this to a friend