Node: Up and Running

Book description

This book introduces you to Node, the new web development framework written in JavaScript. You'll learn hands-on how Node makes life easier for experienced JavaScript developers: not only can you work on the front end and back end in the same language, you'll also have more flexibility in choosing how to divide application logic between client and server.

Written by a core contributor to the framework, Node: Up and Running shows you how Node scales up to support large numbers of simultaneous connections across multiple servers, and scales down to let you create quick one-off applications with minimal infrastructure. Built on the V8 JavaScript engine that runs Google Chrome, Node is already winning the hearts and minds of many companies, including Google and Yahoo! This book shows you why.

  • Understand Node's event-loop architecture, non-blocking I/O, and event-driven programming
  • Discover how Node supports a variety of database and data storage tools
  • Learn best practices for writing easy-to-maintain code for Node
  • Get concrete examples of how to use the various Node APIs in practice
  • Take advantage of the book’s complete API reference

Table of contents

  1. Node: Up and Running
  2. SPECIAL OFFER: Upgrade this ebook with O’Reilly
  3. Foreword by Ryan Dahl
  4. Foreword by Brendan Eich
  5. Preface
    1. Introduction
    2. Conventions Used in This Book
    3. Using Code Examples
    4. Safari® Books Online
    5. How to Contact Us
    6. Acknowledgments
      1. Tom’s Thanks
  6. I. Up and Running
    1. 1. A Very Brief Introduction to Node.js
      1. Installing Node.js
      2. First Steps in Code
        1. Node REPL
        2. A First Server
      3. Why Node?
        1. High-Performance Web Servers
        2. Professionalism in JavaScript
        3. Browser Wars 2.0
    2. 2. Doing Interesting Things
      1. Building a Chat Server
      2. Let’s Build Twitter
    3. 3. Building Robust Node Applications
      1. The Event Loop
      2. Patterns
        1. The I/O Problem Space
          1. Unordered parallel I/O
          2. Ordered serial I/O
      3. Writing Code for Production
        1. Error Handling
        2. Using Multiple Processors
  7. II. Deep Dive and API Reference
    1. 4. Core APIs
      1. Events
        1. EventEmitter
        2. Callback Syntax
      2. HTTP
        1. HTTP Servers
        2. HTTP Clients
          1. Making HTTP GET requests
          2. Uploading data for HTTP POST and PUT
          3. The ClientResponse object
        3. URL
        4. querystring
      3. I/O
        1. Streams
          1. Readable streams
        2. Filesystem
        3. Buffers
          1. A quick primer on binary
          2. Binary and strings
          3. Using Buffers
          4. Working with strings
        4. console.log
    2. 5. Helper APIs
      1. DNS
      2. Crypto
        1. Hashing
        2. HMAC
        3. Public Key Cryptography
          1. Encrypting with Cipher
          2. Decrypting with Decipher
          3. Creating signatures using Sign
          4. Verifying signatures with Verify
      3. Processes
        1. process Module
          1. process events
          2. Interacting with the current Node process
          3. Operating system input/output
            1. process.stdin
            2. process.stderr
          4. Event loop and tickers
        2. Child Process
          1. child_process.exec( )
          2. child_process.spawn( )
      4. Testing Through assert
      5. VM
    3. 6. Data Access
      1. NoSQL and Document Stores
        1. CouchDB
          1. Installation
            1. Installing CouchDB
            2. Installing CouchDB’s Node module
          2. Using CouchDB over HTTP
          3. Using node-couchdb
            1. Working with databases
            2. Creating documents
            3. Reading documents
            4. Updating documents
            5. Deleting documents
        2. Redis
          1. Installation
            1. Installing Redis
            2. Installing Redis’s Node module
          2. Basic usage
          3. Hashes
          4. Lists
          5. Sets
          6. Sorted sets
          7. Subscriptions
          8. Securing Redis
        3. MongoDB
          1. MongoDB native driver
            1. Installation
            2. Data types
            3. Writing records
          2. Mongoose
            1. Installation
            2. Defining schemas
            3. Manipulating collections
            4. Performance
      2. Relational Databases
        1. MySQL
          1. Using NodeDB
            1. Installation
            2. Selection
            3. Insertion
            4. Updating
            5. Deletion
          2. Sequelize
        2. PostgreSQL
          1. Installation
          2. Selection
          3. Insertion, updates, and deletion
      3. Connection Pooling
      4. MQ Protocols
        1. RabbitMQ
          1. Installing RabbitMQ
          2. Publish and subscribe
          3. Work queues
    4. 7. Important External Modules
      1. Express
        1. A Basic Express App
        2. Setting Up Routes in Express
        3. Handling Form Data
        4. Template Engines
          1. Layouts and partial views
        5. Middleware
          1. Middleware factories
      2. Socket.IO
        1. Namespaces
        2. Using Socket.IO with Express
    5. 8. Extending Node
      1. Modules
      2. Package Manager
        1. Searching Packages
        2. Creating Packages
        3. Publishing Packages
        4. Linking
      3. Add-ons
  8. Glossary
  9. Index
  10. About the Authors
  11. Colophon
  12. SPECIAL OFFER: Upgrade this ebook with O’Reilly

Product information

  • Title: Node: Up and Running
  • Author(s): Tom Hughes-Croucher, Mike Wilson
  • Release date: April 2012
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781449336950