small medium large xlarge

Node.js the Right Way: Practical, Server-Side JavaScript That Scales


Cover image for Node.js the Right Way

Node.js the Right Way

Practical, Server-Side JavaScript That Scales


Get to the forefront of server-side JavaScript programming by writing compact, robust, fast, networked Node applications that scale. Ready to take JavaScript beyond the browser, explore dynamic languages features and embrace evented programming? Explore the fun, growing repository of Node modules provided by npm. Work with multiple protocols, load-balanced RESTful web services, express, ØMQ, Redis, CouchDB, and more. Develop production-grade Node applications fast.

Node.js 8 the Right Way is available here.

Customer Reviews

Node.js the Right Way really is the right way to get a fast start with modern serverside
JavaScript programming. It goes far beyond the basic mechanics of JavaScript
and Node and shows you what really goes into making a quality server-side

- Allen Wirfs-Brock

Project editor, ECMAScript Language Specification

If you’re just getting started with Node, skip everything else––this is the only book
you’ll need.

- Rick Waldron

Software engineer,, Boucoup, LLC

Finally, a book that teaches that Node.js is much more than a bare-bones webscale
application server for hipsters.

- Eric Redmond

Coauthor of Seven Databases in Seven Weeks

Node.js the Right Way is a great read that quickly demonstrates Node’s flexibility
and power. It’s perfect for any JavaScript developer who’s interested in exploring
the world of server infrastructure.

- Xavi Ramirez

, Baydin, Inc.

Node.js the Right Way is the right book to read. Skipping “Hello World” in favor
of applicable examples, Wilson delivers a comprehensive introduction that is
detailed yet engaging.

- Daniel Renfro

Lead software engineer, Vistaprint

This book is a fantastic way to explain Node. I even used some of Jim’s example
code in a personal project (especially Chapter 7).

- Mitchell Foley

Software engineer, Google

See All Reviews

What You Need

  • Latest stable release of Node.js, this book was written with 0.12.x in mind.
  • The ØMQ (ZeroMQ) library, version 3.2 or higher.

Contents & Extracts

  • Acknowledgments
  • Preface
    • Why Node.js the Right Way
    • What’s in This Book
    • What This Book Is Not
    • Code Examples and Conventions
    • Online Resources
  • Getting Started
    • Node’s Niche
    • How Node Applications Work
    • Aspects of Node.js Development
    • Get Node.js
  • Wrangling the File System
    • Programming for the Node.js Event Loop
    • Spawning a Child Process
    • Capturing Data from an EventEmitter
    • Reading and Writing Files Asynchronously
    • The Two Phases of a Node Program
    • Wrapping Up
  • Networking with Sockets excerpt
    • Listening for Socket Connections
    • Implementing a Messaging Protocol
    • Creating Socket Client Connections
    • Testing Network Application Functionality
    • Extending Core Classes in Custom Modules
    • Wrapping Up
  • Robust Messaging Services
    • Advantages of ØMQ
    • Importing External Modules with npm
    • Message-Publishing and -Subscribing
    • Responding to Requests
    • Routing and Dealing Messages
    • Clustering Node.js Processes
    • Pushing and Pulling Messages
    • Wrapping Up
  • Accessing Databases
    • Advantages of CouchDB
    • Creating a Package
    • Making RESTful Requests
    • Importing Real Data
    • Unit Testing with Nodeunit
    • Throttling Node.js
    • Querying Data with Mapreduce Views
    • Wrapping Up
  • Scalable Web Services
    • Advantages of Express
    • Serving APIs with Express
    • Writing Modular Express Services
    • RESTful APIs with Promises
    • Yielding Control with Generators
    • Using Generators with Promises
    • Wrapping Up
  • Web Apps excerpt
    • Storing Express Sessions in Redis
    • Creating a Single-Page Web Application
    • Authenticating with Passport
    • Authorizing APIs with Custom Middleware
    • Creating Authenticated APIs
    • Client-Side MVC
    • Wrapping Up
    • Parting Thoughts


Jim R. Wilson is a software engineer at Google. He’s contributed to several open-source projects including corridor, HBase, MediaWiki, and Node.js. In addition to coding and writing, Jim is a speaker and co-author of Seven Databases in Seven Weeks.