Chapter 1. Welcome to Node.js
Listing 1.1. Using core modules and streams
Listing 1.2. Hello World with Node’s http module
Listing 1.3. A Node web application
Chapter 2. Node programming fundamentals
Listing 2.1. Defining a Node module (currency.js)
Listing 2.2. Requiring a module (test_currency.js)
Listing 2.3. Module won’t work as expected
Listing 2.4. A list of post titles
Listing 2.5. A basic HTML template to render the blog titles
Listing 2.6. Using callbacks in a simple application
Listing 2.7. Reducing nesting by creating intermediary functions
Listing 2.8. Reducing nesting by returning early
Listing 2.9. Using the on method to respond to events
Listing 2.10. Using the once method to respond to a single event
Listing 2.11. A simple publish/subscribe system using an event emitter
Listing 2.12. Creating a listener to clean up when clients disconnect
Listing 2.13. Extending the event emitter’s functionality
Listing 2.14. How scope behavior can lead to bugs
Listing 2.15. Using an anonymous function to preserve a global variable’s value
Listing 2.16. Serial control using a community-created add-on
Listing 2.17. Serial flow control implemented in a simple application
Listing 2.18. Parallel flow control implemented in a simple application
Listing 2.19. Using a community add-on flow-control tool in a simple application
Chapter 3. What is a Node web application?
Listing 3.1. RESTful routes example
Listing 3.2. Adding a body parser
Listing 3.3. An Article model