O'Reilly logo

Learning Node, 2nd Edition by Shelley Powers

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 11. Node in Development and Production

The birth of Node coincided with, and even inspired, a host of new tools and techniques for code development, management, and maintenance.  Debugging, testing, task management, production rollout,  and support are key elements of any Node project, and it’s a good thing that most are automated.

This chapter introduces some of the tools and the concepts. It is not an exhaustive list, but should provide a good start in your explorations.

Debugging Node Applications

I confess to using console logging more than I should for debugging. It is an easy approach to checking variable values and results. However, the issue with using the console is that we’re impacting on the dynamics and behavior of the application, and could actually be masking—or creating—a problem just by its use. It really is better to use debugging tools, especially when the application grows beyond simple blocks of code.

Node provides a built-in debugger we can use to set breakpoints in the code and add watchers in order to view intermediate code results. It’s not the most sophisticated tool in the world, but it is sufficient for discovering bugs and potential gotchas. In the next section, we’ll look at a more sophisticated tool, the Node Inspector.

The Node Debugger

Given the choice, I’ll always prefer native implementations rather than using third-party functionality. Luckily for our debugging needs, Node does provide built-in debugger support. It’s not sophisticated ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required