O'Reilly logo

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

Building Node Applications with MongoDB and Backbone

Book Description

Build an application from backend to browser with Node.js, and kick open the doors to real-time event programming. With this hands-on book, you’ll learn how to create a social network application similar to LinkedIn and Facebook, but with a real-time twist. And you’ll build it with just one programming language: JavaScript.

If you’re an experienced web developer unfamiliar with JavaScript, the book’s first section introduces you to the project’s core technologies: Node.js, Backbone.js, and the MongoDB data store. You’ll then launch into the project—a highly responsive, highly scalable application—guided by clear explanations and lots of code examples.

  • Learn about key modules in Node.js for building real-time apps
  • Use the Backbone.js framework to write clean browser code, and maintain better data integration with MongoDB
  • Structure project files as a foundation for code that will arrive later
  • Create user accounts and learn how to secure the data
  • Use Backbone.js templates to build the application’s UIs, and integrate access control with Node.js
  • Develop a contact list to help users link to and track other accounts
  • Use Socket.io to create real-time chat functionality
  • Extend your UIs to give users up-to-the-minute information


Table of Contents

  1. Preface
    1. Audience and Assumptions
    2. Organization
      1. Part I: Introduction
      2. Part II: Building a Social Network
    3. Conventions Used in This Book
    4. Using Code Examples
    5. Safari® Books Online
    6. How to Contact Us
  2. I. Introducing Node.js, Backbone.js, and MongoDB
    1. 1. Introduction and Overview
      1. Building a Social Network
      2. Model-View-Controller (MVC)
      3. Pure JavaScript
    2. 2. Node.js
      1. Installing Node.js
      2. Express
        1. Templates
      3. Events
      4. Socket.io
      5. Modules and CommonJS
    3. 3. Backbone.js
      1. Model
      2. View
        1. View Template
      3. Collection
        1. Sync
      4. Router and History
    4. 4. MongoDB
      1. Accessing Data
        1. Writing
        2. Querying
        3. Indexes
        4. MapReduce
      2. Working with Node.js
      3. Concurrent Access
  3. II. Building a Social Network
    1. 5. Setting Up the Project
      1. Directory Structure
        1. File Listing
      2. Package Definition
      3. Web Server
        1. Index Template
        2. Application JavaScript
          1. Application class
          2. Index view object
    2. 6. Authentication
      1. Account
      2. Routing
        1. Checking for Authentication
        2. Authentication Handler
      3. Registration
        1. Registration Template
        2. Registration Handler
      4. Login
        1. Login Template
        2. Login Handler
      5. Forgot Password
        1. Forgot Password Template
        2. Forgot Password Handler
      6. Reset Password
        1. Reset Password Templates
        2. Reset Password Handler
      7. Putting It Together
        1. Node.js
    3. 7. The User Interface
      1. Account Details
        1. Account Details Template
        2. Account Details Handler
      2. Contact List
      3. Activity Stream
        1. Activity Stream Template
        2. Activity Stream Handler
      4. Data Model
      5. Putting It Together
        1. Backbone
        2. Node.js
    4. 8. Making Friends
      1. Contact List
        1. Contact List Template
        2. Contact List Handler
      2. Add Contact
        1. Add Contact Template
        2. Add Contact Handler
      3. Remove Contact
        1. Remove Contact Template
        2. Remove Contact Handler
      4. Commenting
        1. Comment Template
        2. Comment Handler
      5. Putting It Together
        1. Backbone
          1. Router
          2. Index
        2. Node.js
          1. Main Express application
          2. Account model
    5. 9. Chat
      1. Refactoring
      2. Connecting to the Chat Server
        1. Backbone
        2. Node.js
      3. Sending and Receiving Chat Messages
        1. Backbone
        2. Node.js
      4. Putting It Together
        1. Backbone
        2. Node.js
    6. 10. Activities in Real Time
      1. Adding Custom Events
        1. Triggering Events
        2. Adding Listeners
      2. Contact Login Notification
        1. Backbone.js
        2. Node.js
      3. Status Updates
        1. Backbone.js
        2. Node.js
      4. Putting It Together
        1. Backbone.js
        2. Node.js
        3. Static Files
  4. Glossary
  5. About the Author
  6. Colophon
  7. Copyright