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.

Choose Your Format(s)

  • $27.00 In Stock

    Save $1.00 on the combo pack.

  • $17.00 In Stock
  • $11.00 In Stock
  • Ebooks are DRM free.

  • Ebook delivery options.

About this Title

Pages: 148
Published: 2013-11-20
Release: P1.0 (2013-11-20)
ISBN: 978-1-93778-573-4

JavaScript is the backbone of the modern web, powering nearly every web app’s user interface. Node.js is JavaScript for the server. This book shows you how to develop small, fast, low-profile, useful, networked applications. You’ll write asynchronous, non-blocking code using Node’s style and patterns. You’ll cluster and load balance your services with Node core features and third-party tools. You’ll work with many protocols, creating RESTful web services, TCP socket clients and servers, and more.

This short book packs a hefty dose of Node.js. You’ll test your code’s functionality and performance under load. You’ll learn important aspects of Node development—from its architecture and core, to its ecosystem of third-party modules. You’ll discover how Node pairs a server-side event loop with a JavaScript runtime to produce screaming fast, non-blocking concurrency. Through a series of practical programming domains, you’ll use the latest available ECMAScript Harmony features and harness key Node classes such as EventEmitter and Stream. Throughout the book, you’ll develop real programs that are small, fast, low-profile, and useful.

Get ready to join a smart community that’s rapidly advancing the state of the art in web development.

Read the 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.