Learning Node.js: A Hands-On Guide to Building Web Applications in JavaScript

Book description

Learning Node.js
A Hands-On Guide to Building Web Applications in JavaScript

Node.js makes it far easier to create fast, compact, and reliable web/network applications and web servers, and is rapidly becoming indispensable to modern web developers.

Learning Node.js brings together the knowledge and JavaScript code you need to build master the Node.js platform and build server-side applications with extraordinary speed and scalability.

You’ll start by installing and running Node.js, understanding the extensions it uses, and quickly writing your first app. Next, building on the basics, you’ll write more capable application servers and extend them with today’s most powerful Node.js tools and modules. Finally, you’ll discover today’s best practices for testing, running Node.js code on production servers, and writing command-line utilities.

Throughout the book, author Marc Wandschneider teaches by walking you line-by-line through carefully crafted examples, demonstrating proven techniques for creating highly efficient applications and servers.

  • Build Node.js solutions that leverage your current JavaScript skills

  • Master Node.js nonblocking IO and async programming

  • Handle more requests and increase your application’s flexibility

  • Use and write your own modules

  • Perform common JSON/web server tasks

  • Use browsers to generate pages on the fly via Ajax calls and template libraries

  • Simplify development with the express framework

  • Create database back-ends using popular NoSQL and relational databases

  • Deploy and run Node.js apps on Unix/OS X or Windows servers

  • Take advantage of multiprocessor hardware

  • Support virtual hosts and SSL/HTTPS security

  • Test Node.js programs that mix synchronous, async, and RESTful server API functionality

Table of contents

  1. About This eBook
  2. Title Page
  3. Copyright Page
  4. Dedication Page
  5. Table of Contents
  6. Acknowledgments
  7. About the Author
  8. Introduction
    1. Why Node.js?
    2. What Exactly Is Node.js?
    3. Who Is This Book For?
    4. How to Use This Book
    5. Download the Source Code
  9. Part I: Learning to Walk
    1. 1. Getting Started
      1. Installing Node.js
      2. Running Node.js and “Hello World!”
      3. Your First Web Server
      4. Debugging Your Node.js Programs
      5. Staying Up-to-Date and Finding Help
      6. Summary
    2. 2. A Closer Look at JavaScript
      1. Types
      2. Type Comparisons and Conversions
      3. Functions
      4. Language Constructs
      5. Classes, Prototypes, and Inheritance
      6. Errors and Exceptions
      7. Some Important Node.js Globals
      8. Summary
    3. 3. Asynchronous Programming
      1. The Old Way of Doing Things
      2. The Node.js Way of Doing Things
      3. Error Handling and Asynchronous Functions
      4. Who Am I? Maintaining a Sense of Identity
      5. Being Polite—Learning to Give Up Control
      6. Synchronous Function Calls
      7. Summary
  10. Part II: Learning to Run
    1. 4. Writing Simple Applications
      1. Your First JSON Server
      2. Node Pattern: Asynchronous Loops
      3. Learning to Juggle: Handling More Requests
      4. More on the Request and Response Objects
      5. Increased Flexibility: GET Params
      6. Modifying Things: POST Data
      7. Summary
    2. 5. Modules
      1. Writing Simple Modules
      2. npm: The Node Package Manager
      3. Consuming Modules
      4. Writing Modules
      5. A Module So Common It Should Be Built In
      6. Summary
    3. 6. Expanding Your Web Server
      1. Serving Static Content with Streams
      2. Assembling Content on the Client: Templates
      3. Summary
  11. Part III: Writing Web Applications
    1. 7. Building Web Applications with Express
      1. Installing Express
      2. Routing and Layers in Express
      3. REST API Design and Modules
      4. Additional Middleware Functionality
      5. Summary
    2. 8. Databases I: NoSQL (MongoDB)
      1. Setting Up MongoDB
      2. Structuring Your Data for MongoDB
      3. Understanding the Basic Operations
      4. Updating Your Photo Albums App
      5. Recapping the App Structure
      6. Summary
    3. 9. Databases II: SQL (MySQL)
      1. Getting Ready
      2. Creating a Schema for the Database
      3. Basic Database Operations
      4. Adding Authentication to the Application
      5. Resource Pooling
      6. Authenticating the API
      7. Summary
  12. Part IV: Getting the Most Out of Node.js
    1. 10. Deployment and Development
      1. Deployment
      2. Multiprocessor Deployment: Using a Proxy
      3. Virtual Hosting
      4. Securing Your Projects with HTTPS/SSL
      5. Multiplatform Development
      6. Summary
    2. 11. Command-Line Programming
      1. Running Command-Line Scripts
      2. Working with Files Synchronously
      3. Interacting with the User: stdin/stdout
      4. Working with Processes
      5. Summary
    3. 12. Testing
      1. Choosing a Framework
      2. Writing Tests
      3. RESTful API Testing
      4. Summary
  13. Index

Product information

  • Title: Learning Node.js: A Hands-On Guide to Building Web Applications in JavaScript
  • Author(s):
  • Release date: June 2013
  • Publisher(s): Addison-Wesley Professional
  • ISBN: 9780133377989