About this Book

The first edition of Node.js in Action was about web development with a particular focus on the Connect and Express web frameworks. Node.js in Action, Second Edition has been updated to suit the changing requirements of Node development. You’ll learn about front-end build systems, popular Node web frameworks, and how to build a web application with Express from scratch. You’ll also learn how to create automated tests and deploy Node web applications.

Node is being increasingly used for command-line developer tools and desktop applications with Electron, so you’ll find chapters dedicated to both of these areas.

This book assumes you’re familiar with basic programming concepts. The first chapter provides an overview of JavaScript and ES2015 for those of you who haven’t yet discovered the joys of modern JavaScript.

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 JavaScript and Node and steps through example code. Chapter 2 guides you through fundamental Node.js programming concepts. Chapter 3 is a full tutorial on how to build a web application from scratch.

Part 2, the largest section of the book, focuses on web application development. Chapter 4 dispels some of the mystery around front-end build systems: if you’ve ever had to use webpack or Gulp in a project but didn’t really understand it, this is the chapter for you. Chapter 5 reviews some of the most popular server-side frameworks available for Node, and chapter 6 goes into Connect and Express in more depth. Chapter 7 is dedicated to templating languages, which can improve your productivity when writing server-side code. Most web applications need a database, so chapter 8 covers the many types of databases that you can use with Node, from relational to NoSQL. Chapters 9 and 10 deal with testing and deployment, and this includes cloud deployment.

Part 3 goes beyond web application development. Chapter 11 is about building command-line applications with Node so you can create developer-friendly text interfaces. If you’re excited about the prospect of building desktop apps such as Atom with Node, then take a look at chapter 12, which is all about Electron.

We’ve also included three detailed appendixes. Appendix A has instructions on how to install Node for macOS and Windows. Appendix B is a detailed tutorial on web scraping, and appendix C reviews each of the officially supported middleware components for the Connect web framework.

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/books/node-js-in-action-second-edition.

Book Forum

Purchase of Node.js in Action, Second Edition includes free access to a private web forum run by Manning Publications where you can make comments about the book, ask technical questions, and receive help from the author and from other users. To access the forum, go to https://forums.manning.com/forums/node-js-in-action-second-edition. You can also learn more about Manning’s forums and the rules of conduct at https://forums.manning.com/forums/about.

Manning’s commitment to our readers is to provide a venue where a meaningful dialogue between individual readers and between readers and the author can take place. It is not a commitment to any specific amount of participation on the part of the author, whose contribution to the forum remains voluntary (and unpaid). We suggest you try asking the author some challenging questions lest his interest stray! The forum and the archives of previous discussions will be accessible from the publisher’s website as long as the book is in print.