Preface - Node.js in Action (2014)

Node.js in Action (2014)

Preface

In early 2011, when Manning approached us with the idea of writing a book on Node.js, the state of the Node community was much different than it is now. The community was small and, despite the fact that Node was starting to attract a great deal of interest, Node was still considered a bleeding-edge technology by the mainstream development community. No books had yet been written about it, and although the idea of writing a book was daunting, we decided to go for it.

Given our respective development inclinations, we wanted to create a book that not only focused on the use of Node for web application development, but also explored other interesting potential uses. We wanted to provide a way for web application developers using conventional technologies to harness Node’s vision of bringing asynchronous development to the server.

We’ve worked for more than two years on the book, and during its writing the technology has evolved, so we’ve updated the book accordingly. In addition to the technology changing, the community has also evolved. It is now much larger, and many established companies have embraced Node.

For web application developers looking to try something different, this is a great time to learn Node, and we hope our book helps you learn the technology quickly and have fun doing so.

About this Book

Node.js in Action’s primary purpose is to teach you to how to create and deploy Node applications, with a focus on web applications. A considerable part of the book focuses on the Express web application framework and the Connect middleware framework because of their usefulness and community support. You’ll also learn how to create automated tests for, and how to deploy, your applications.

This book is targeted toward experienced web application developers who are interested in creating responsive, scalable applications using Node.js.

Because Node.js applications are written using JavaScript, a working knowledge of the language is a prerequisite. Familiarity with the Windows, OS X, or Linux command line is also recommended.

Roadmap

This book is organized into three parts.

Part 1 provides an introduction to Node.js, teaching the fundamental techniques needed to develop with it. Chapter 1 explains the characteristics of Node and steps through some example code. Chapter 2 guides the reader through the creation of an example application. Chapter 3 explains the challenges of Node.js development, provides techniques for overcoming them, and teaches ways to organize application code.

Part 2 is the largest in the book and focuses on web application development. Chapter 4 teaches the basics of creating Node-driven web applications, and chapter 5 talks about how to store application data using Node.

Part 2 then continues into the world of web-related frameworks. Chapter 6 introduces the Connect framework, explaining its benefits and how it works. Chapter 7 teaches how various built-in Connect framework components can be used to add functionality to web applications. Chapters 8provides an introduction to the Express framework, and chapter 9 guides the reader through advanced Express usage.

With the basics of web development covered, part 2 concludes after exploring two more related topics. Chapter 10 guides the reader through the use of various Node testing frameworks. Chapter 11 then teaches how templating can be used in Node web applications to separate presentation of data from logic.

Part 3 moves on to look at things beyond web development that can be done with Node. Chapter 12 talks about how Node applications can be deployed to production servers, how uptime can be maintained, and how performance can be maximized. Chapter 13 explains how non-HTTP applications can be created, how to use the Socket.io framework to create real-time applications, and the use of a number of handy build-in Node APIs. Chapter 14, the final chapter, discusses how the Node community works and how Node creations can be published using the Node Package Manager.

Code conventions and downloads

The code in this book follows common JavaScript conventions. Spaces, rather than tabs, are used for indentation. Lines longer than 80 characters are avoided. In many listings, the code is annotated to point out key concepts.

A single statement per line is used and semicolons are added at the end of simple statements. For blocks of code, where one or more statements are enclosed in curly braces, the left curly brace is placed at the end of the opening line of the block. The right curly brace is indented so it’s vertically aligned with the opening line of the block.

Source code for the examples in this book is available for download from the publisher’s website at www.manning.com/Node.jsinAction.