You are previewing Node.js, MongoDB, and AngularJS Web Development.
O'Reilly logo
Node.js, MongoDB, and AngularJS Web Development

Book Description

Node.js, MongoDB and AngularJS Web Development
The definitive guide to building JavaScript-based Web applications from server to browser

Node.js, MongoDB, and AngularJS are three new web development technologies that together provide an easy to implement, fully integrated web development stack. Node.js is a leading server-side programming environment, MongoDB is the most popular NoSQL database, and AngularJS is quickly becoming the leading framework for MVC-based front-end development. Together they allow web programmers to create high-performance sites and applications built completely in JavaScript, from server to client.

Node.js, MongoDB and AngularJS Web Development is a complete guide for web programmers who want to integrate these three technologies into full working solutions. It begins with concise, crystal-clear tutorials on each of the three technologies and then quickly moves on to building several common web applications.

Readers will learn how to use Node.js and MongoDB to build more scalable, high-performance sites, how to leverage AngularJS's innovative MVC approach to structure more effective pages and applications, and how to use all three together to deliver outstanding next-generation Web solutions.

  • Implement a highly scalable and dynamic web server using Node.js and Express

  • Build server-side web services in JavaScript

  • Implement a MongoDB data store for your web applications

  • Access and interact with MongoDB from Node.js JavaScript code

  • Define static and dynamic web routes and implement server-side scripts to support them

  • Implement Express in Node.js

  • Create Jade templates

  • Define your own custom AngularJS directives that extend the HTML language

  • Implement client-side services that can interact with the Node.js web server

  • Build dynamic browser views that provide rich user interaction

  • Add authenticated user accounts to your web applications

  • Add nested comment components to your web pages

  • Build an end-to-end shopping cart

  • Table of Contents

    1. Dedication
    2. Contents
    3. About the Author
    4. Acknowledgments
    5. Introduction
      1. Who Should Read This Book
      2. Why You Should Read This Book
      3. What You Will Learn from This Book
      4. What Is Node.js?
      5. What Is MongoDB?
      6. What Is AngularJS?
      7. How Is This Book Organized?
      8. Getting the Code Examples
      9. Finally
    6. Part I: Introduction
      1. 1. Introducing the Node.js to AngularJS Stack
        1. Understanding the Basic Web Development Framework
        2. Understanding the Node.js to AngularJS Stack Components
        3. Summary
        4. Next
      2. 2. JavaScript Primer
        1. Defining Variables
        2. Understanding JavaScript Data Types
        3. Using Operators
        4. Implementing Looping
        5. Creating Functions
        6. Understanding Variable Scope
        7. Using JavaScript Objects
        8. Manipulating Strings
        9. Adding Error Handling
        10. Summary
        11. Next
    7. Part II: Learning Node.js
      1. 3. Getting Started with Node.js
        1. Understanding Node.js
        2. Installing Node.js
        3. Working with Node Packages
        4. Creating a Node.js Application
        5. Writing Data to the Console
        6. Summary
        7. Next
      2. 4. Using Events, Listeners, Timers and Callbacks in Node.js
        1. Understanding Node.js Event Model
        2. Adding Work to the Event Queue
        3. Implementing Callbacks
        4. Summary
        5. Next
      3. 5. Handling Data I/O in Node.js
        1. Working with JSON
        2. Using the Buffer Module to Buffer Data
        3. Using the Stream Module to Stream Data
        4. Compressing and Decompressing data with Zlib
        5. Summary
        6. Next
      4. 6. Accessing the File System from Node.js
        1. Synchronous vs Asynchronous File System Calls
        2. Opening and Closing Files
        3. Writing Files
        4. Reading Files
        5. Other File System Tasks
        6. Summary
        7. Next
      5. 7. Implementing HTTP Services in Node.js
        1. Processing URLs
        2. Processing Query Strings and Form Parameters
        3. Understanding Request, Response and Server Objects
        4. Implementing HTTP Clients and Servers in Node.js
        5. Implementing HTTPS Servers and Clients
        6. Summary
        7. Next
      6. 8. Implementing Socket Services in Node.js
        1. Understanding Network Sockets
        2. Understanding TPC Server and Socket Objects
        3. Implementing TCP Socket Servers and Clients
        4. Implementing TLS Servers and Clients
        5. Summary
        6. Next
      7. 9. Scaling Applications Using Multiple Processors in Node.js
        1. Understanding the Process Module
        2. Implementing Child Processes
        3. Implementing Process Clusters
        4. Summary
        5. Next
      8. 10. Using Additional Node.js Modules
        1. Using the os Module
        2. Using the util Module
        3. Summary
        4. Next
    8. Part III: Learning MongoDB
      1. 11. Understanding NoSQL and MongoDB
        1. Why NoSQL?
        2. Understanding MongoDB
        3. MongoDB Data Types
        4. Planning your Data Model
        5. Summary
        6. Next
      2. 12. Getting Started with MongoDB
        1. Building the MongoDB Environment
        2. Administrating User Accounts
        3. Configuring Access Control
        4. Administering Databases
        5. Managing Collections
        6. Summary
        7. Next
      3. 13. Getting Started with MongoDB and Node.js
        1. Adding the MongoDB Driver to Node.js
        2. Connecting to MongoDB from Node.js
        3. Understanding the Objects Used in the MongoDB Node.js Driver
        4. Accessing and Manipulating Databases
        5. Accessing and Manipulating Collections
        6. Summary
        7. Next
      4. 14. Manipulating MongoDB Documents from Node.js
        1. Understanding Database Change Options
        2. Understanding Database Update Operators
        3. Getting Documents from a Collection
        4. Adding Documents to a Collection
        5. Updating Documents in a Collection
        6. Atomically Modifying Documents in a Collection
        7. Saving Documents in a Collection
        8. Upserting Documents in Collection
        9. Deleting Documents from a Collection
        10. Removing a Single Document from a Collection
        11. Summary
        12. Next
      5. 15. Accessing MongoDB Documents from Node.js
        1. Introducing the Dataset
        2. Understanding Query Objects
        3. Understanding Query Options Objects
        4. Finding Specific Sets of Documents
        5. Counting Documents
        6. Limiting Result Sets
        7. Sorting Results Sets
        8. Finding Distinct Field Values
        9. Grouping Results
        10. Applying MapReduce by Aggregating Results
        11. Summary
        12. Next
      6. 16. Using Mongoose for Structured Schema and Validation
        1. Understanding Mongoose
        2. Connecting to a MongoDB Database Using Mongoose
        3. Defining a Schema
        4. Compiling a Model
        5. Understanding the Query Object
        6. Understanding the Document Object
        7. Finding Documents Using Mongoose
        8. Adding Documents Using Mongoose
        9. Updating Documents Using Mongoose
        10. Removing Documents Using Mongoose
        11. Aggregating Documents Using Mongoose
        12. Using the Validation Framework
        13. Implementing Middleware Functions
        14. Summary
        15. Next
      7. 17. Advanced MongoDB Concepts
        1. Adding Indexes
        2. Using Capped Collections
        3. Applying Replication
        4. Implementing Sharding
        5. Implementing a GridFS Store
        6. Repairing a MongoDB Database
        7. Backing Up MongoDB
        8. Summary
        9. Next
    9. Part IV: Using Express to Make Life Easier
      1. 18. Implementing Express in Node.js
        1. Getting Started with Express
        2. Configuring Routes
        3. Using Requests Objects
        4. Using Response Objects
        5. Implementing a Template Engine
        6. Summary
        7. Next
      2. 19. Implementing Express Middleware
        1. Understanding Middleware
        2. Using the Query Middleware
        3. Serving Static Files
        4. Handling POST Body Data
        5. Sending and Receiving Cookies
        6. Implementing Sessions
        7. Applying Basic HTTP Authentication
        8. Implementing Session Authentication
        9. Creating Custom Middleware
        10. Summary
        11. Next
    10. Part V: Learning AngularJS
      1. 20. Getting Started with AngularJS
        1. Why AngularJS
        2. Understanding AngularJS
        3. Overview of AngularJS Life Cycle
        4. Integrating AngularJS with Existing JavaScript and jQuery
        5. Adding AngularJS to the Node.js Environment
        6. Bootstrapping AngularJS in the HTML Document
        7. Using the Global APIs
        8. Creating a Basic AngularJS Application
        9. Summary
        10. Next
      2. 21. Understanding AngularJS Modules and Dependency Injection
        1. Overview of Modules and Dependency Injection
        2. Defining the AngularJS Modules
        3. Implementing Dependency Injection
        4. Summary
        5. Next
      3. 22. Implementing the Scope as a Data Model
        1. Understanding Scopes
        2. Implementing Scope Hierarchy
        3. Emitting and Broadcasting Events
        4. Summary
        5. Next
      4. 23. Using AngularJS Templates to Create Views
        1. Understanding Templates
        2. Using Expressions
        3. Using Filters
        4. Creating Custom Filters
        5. Summary
        6. Next
      5. 24. Implementing Directives in AngularJS Views
        1. Understanding Directives
        2. Using Built-in Directives
        3. Creating Your Own Directives to Extend HTML
        4. Summary
        5. Next
      6. 25. Implementing AngularJS Services in Web Applications
        1. Understanding AngularJS Services
        2. Using the Built-in Services
        3. Creating Custom Services
        4. Summary
        5. Next
    11. Part VI: Building Practical Web Application Components
      1. 26. Adding User Accounts to Your Web Site
        1. Libraries Used
        2. Project Directory Structure
        3. Defining the User Model
        4. Creating the Server
        5. Implementing Routes
        6. Implementing the User Controller Routes
        7. Implementing the User and Authentication Views
        8. Implementing the AngularJS Module and Controller
        9. Using Social Media Accounts as Authentication Sources
        10. Summary
        11. Next
      2. 27. Adding Comment Threads to Pages
        1. Libraries Used
        2. Project Directory Structure
        3. Defining the Comment, Reply, Photo and Page Models
        4. Creating the Comments Server
        5. Implementing Routes to Support Viewing and adding Comments
        6. Implementing the Model Based Controller Routes
        7. Implementing Photo and Comment Views
        8. Implementing the AngularJS Module and Controller to support Comment Views
        9. Initializing the Application
        10. Summary
        11. Next
      3. 28. Creating Your Own Shopping Cart
        1. Project Description
        2. Libraries Used
        3. Project Directory Structure
        4. Defining the Customer, Product and Orders Models
        5. Creating the Shopping Cart Server
        6. Implementing Routes to Support Product, Cart and Order Requests
        7. Implementing the Model Based Controller Routes
        8. Implementing Shopping Cart and Checkout Views
        9. Implementing the AngularJS Module and Controller to support Shopping Cart Views
        10. Initializing the Application
        11. Summary
        12. Next
      4. 29. Building Interactive Web 2.0 Application Components
        1. Project Description
        2. Libraries Used
        3. Project Directory Structure
        4. Defining the Project Model
        5. Creating the Application Server
        6. Implementing Routes to Support the Views
        7. Implementing a Tabbed View
        8. Implementing a Weather Service View
        9. Implementing Draggable Elements
        10. Implementing Dynamic Data Access
        11. Initializing the Application
        12. Summary