Contents

Introduction

I: Getting Started

1 Introducing the Node.js-to-Angular Stack

Understanding the Basic Web Development Framework

User

Browser

Webserver

Backend Services

Understanding the Node.js-to-Angular Stack Components

Node.js

MongoDB

Express

Angular

Summary

Next

2 JavaScript Primer

Defining Variables

Understanding JavaScript Data Types

Using Operators

Arithmetic Operators

Assignment Operators

Applying Comparison and Conditional Operators

Implementing Looping

while Loops

do/while Loops

for Loops

for/in Loops

Interrupting Loops

Creating Functions

Defining Functions

Passing Variables to Functions

Returning Values from Functions

Using Anonymous Functions

Understanding Variable Scope

Using JavaScript Objects

Using Object Syntax

Creating Custom-Defined Objects

Using a Prototyping Object Pattern

Manipulating Strings

Combining Strings

Searching a String for a Substring

Replacing a Word in a String

Splitting a String into an Array

Working with Arrays

Combining Arrays

Iterating Through Arrays

Converting an Array into a String

Checking Whether an Array Contains an Item

Adding and Removing Items to Arrays

Adding Error Handling

try/catch Blocks

Throw Your Own Errors

Using finally

Summary

Next

II: Learning Node.js

3 Getting Started with Node.js

Understanding Node.js

Who Uses Node.js?

What Is Node.js Used For?

What Does Node.js Come With?

Installing Node.js

Looking at the Node.js Install Location

Verify Node.js Executables

Selecting a Node.js IDE

Working with Node Packages

What Are Node Packaged Modules?

Understanding the Node Package Registry

Using the Node Package Manager

Searching for Node Package Modules

Installing Node Packaged Modules

Using package.json

Creating a Node.js Application

Creating a Node.js Packaged Module

Publishing a Node.js Packaged Module to the NPM Registry

Using a Node.js Packaged Module in a Node.js Application

Writing Data to the Console

Summary

Next

4 Using Events, Listeners, Timers, and Callbacks in Node.js

Understanding the Node.js Event Model

Comparing Event Callbacks and Threaded Models

Blocking I/O in Node.js

The Conversation Example

Adding Work to the Event Queue

Implementing Timers

Using nextTick to Schedule Work

Implementing Event Emitters and Listeners

Implementing Callbacks

Passing Additional Parameters to Callbacks

Implementing Closure in Callbacks

Chaining Callbacks

Summary

Next

5 Handling Data I/O in Node.js

Working with JSON

Converting JSON to JavaScript Objects

Converting JavaScript Objects to JSON

Using the Buffer Module to Buffer Data

Understanding Buffered Data

Creating Buffers

Writing to Buffers

Reading from Buffers

Determining Buffer Length

Copying Buffers

Slicing Buffers

Concatenating Buffers

Using the Stream Module to Stream Data

Readable Streams

Writable Streams

Duplex Streams

Transform Streams

Piping Readable Streams to Writable Streams

Compressing and Decompressing Data with Zlib

Compressing and Decompressing Buffers

Compressing/Decompressing Streams

Summary

Next

6 Accessing the File System from Node.js

Synchronous Versus Asynchronous File System Calls

Opening and Closing Files

Writing Files

Simple File Write

Synchronous File Writing

Asynchronous File Writing

Streaming File Writing

Reading Files

Simple File Read

Synchronous File Reading

Asynchronous File Reading

Streaming File Reading

Other File System Tasks

Verifying Path Existence

Getting File Info

Listing Files

Deleting Files

Truncating Files

Making and Removing Directories

Renaming Files and Directories

Watching for File Changes

Summary

Next

7 Implementing HTTP Services in Node.js

Processing URLs

Understanding the URL Object

Resolving the URL Components

Processing Query Strings and Form Parameters

Understanding Request, Response, and Server Objects

The http.ClientRequest Object

The http.ServerResponse Object

The http.IncomingMessage Object

The http.Server Object

Implementing HTTP Clients and Servers in Node.js

Serving Static Files

Implementing Dynamic GET Servers

Implementing POST Servers

Interacting with External Sources

Implementing HTTPS Servers and Clients

Creating an HTTPS Client

Creating an HTTPS Server

Summary

Next

8 Implementing Socket Services in Node.js

Understanding Network Sockets

Understanding TPC Server and Socket Objects

The net.Socket Object

The net.Server Object

Implementing TCP Socket Servers and Clients

Implementing a TCP Socket Client

Implementing a TCP Socket Server

Implementing TLS Servers and Clients

Creating a TLS Socket Client

Creating a TLS Socket Server

Summary

Next

9 Scaling Applications Using Multiple Processors in Node.js

Understanding the Process Module

Understanding Process I/O Pipes

Understanding Process Signals

Controlling Process Execution with the process Module

Getting Information from the process Module

Implementing Child Processes

Understanding the ChildProcess Object

Executing a System Command on Another Process Using exec()

Executing an Executable File on Another Process Using execFile()

Spawning a Process in Another Node.js Instance Using spawn()

Implementing Child Forks

Implementing Process Clusters

Using the Cluster Module

Understanding the Worker Object

Implementing an HTTP Cluster

Summary

Next

10 Using Additional Node.js Modules

Using the os Module

Using the util Module

Formatting Strings

Checking Object Types

Converting JavaScript Objects to Strings

Inheriting Functionality from Other Objects

Using the dns Module

Using the crypto Module

Other Node Modules and Objects

Summary

Next

III: Learning MongoDB

11 Understanding NoSQL and MongoDB

Why NoSQL?

Understanding MongoDB

Understanding Collections

Understanding Documents

MongoDB Data Types

Planning Your Data Model

Normalizing Data with Document References

Denormalizing Data with Embedded Documents

Using Capped Collections

Understanding Atomic Write Operations

Considering Document Growth

Identifying Indexing, Sharding, and Replication Opportunities

Large Collections Versus Large Numbers of Collections

Deciding on Data Life Cycles

Considering Data Usability and Performance

Summary

Next

12 Getting Started with MongoDB

Building the MongoDB Environment

Installing MongoDB

Starting MongoDB

Stopping MongoDB

Accessing MongoDB from the Shell Client

Administering User Accounts

Listing Users

Creating User Accounts

Removing Users

Configuring Access Control

Creating a User Administrator Account

Turning on Authentication

Creating a Database Administrator Account

Administering Databases

Displaying a List of Databases

Changing the Current Database

Creating Databases

Deleting Databases

Copying Databases

Managing Collections

Displaying a List of Collections in a Database

Creating Collections

Deleting Collections

Finding Documents in a Collection

Adding Documents to a Collection

Deleting Documents in a Collection

Updating Documents in a Collection

Summary

Next

13 Getting Started with MongoDB and Node.js

Adding the MongoDB Driver to Node.js

Connecting to MongoDB from Node.js

Understanding the Write Concern

Connecting to MongoDB from Node.js Using the MongoClient Object

Understanding the Objects Used in the MongoDB Node.js Driver

Understanding the Db Object

Understanding the Admin Object

Understanding the Collection Object

Understanding the Cursor Object

Accessing and Manipulating Databases

Listing Databases

Creating a Database

Deleting a Database

Creating, Listing, and Deleting Databases Example

Getting the Status of the MongoDB Server

Accessing and Manipulating Collections

Listing Collections

Creating Collections

Deleting Collections

Collection Creation, Listing, and Deleting Example

Getting Collection Information

Summary

Next

14 Manipulating MongoDB Documents from Node.js

Understanding Database Change Options

Understanding Database Update Operators

Adding Documents to a Collection

Getting Documents from a Collection

Updating Documents in a Collection

Atomically Modifying Documents in a Collection

Saving Documents in a Collection

Upserting Documents in Collection

Deleting Documents from a Collection

Removing a Single Document from a Collection

Summary

Next

15 Accessing MongoDB from Node.js

Introducing the Data Set

Understanding Query Objects

Understanding Query Options Objects

Finding Specific Sets of Documents

Counting Documents

Limiting Result Sets

Limiting Results by Size

Limiting Fields Returned in Objects

Paging Results

Sorting Result Sets

Finding Distinct Field Values

Grouping Results

Applying MapReduce by Aggregating Results

Understanding the aggregate() Method

Using Aggregation Framework Operators

Implementing Aggregation Expression Operators

Aggregation Examples

Summary

Next

16 Using Mongoose for Structured Schema and Validation

Understanding Mongoose

Additional Objects

Connecting to a MongoDB Database Using Mongoose

Defining a Schema

Understanding Paths

Creating a Schema Definition

Adding Indexes to a Schema

Implementing Unique Fields

Forcing Required Fields

Adding Methods to the Schema Model

Implementing the Schema on the Words Database

Compiling a Model

Understanding the Query Object

Setting the Query Database Operation

Setting the Query Database Operation Options

Setting the Query Operators

Understanding the Document Object

Finding Documents Using Mongoose

Adding Documents Using Mongoose

Updating Documents Using Mongoose

Saving Document Changes

Updating a Single Document

Updating Multiple Documents

Removing Documents Using Mongoose

Removing a Single Document

Removing Multiple Documents

Aggregating Documents Using Mongoose

Using the Validation Framework

Implementing Middleware Functions

Summary

Next

17 Advanced MongoDB Concepts

Adding Indexes

Using Capped Collections

Applying Replication

Replication Strategy

Deploying a Replica Set

Implementing Sharding

Sharding Server Types

Choosing a Shard Key

Selecting a Partitioning Method

Deploying a Sharded MongoDB Cluster

Repairing a MongoDB Database

Backing Up MongoDB

Summary

Next

IV: Using Express to Make Life Easier

18 Implementing Express in Node.js

Getting Started with Express

Configuring Express Settings

Starting the Express Server

Configuring Routes

Implementing Routes

Applying Parameters in Routes

Using Requests Objects

Using Response Objects

Setting Headers

Setting the Status

Sending Response

Sending JSON Responses

Sending Files

Sending a Download Response

Redirecting the Response

Implementing a Template Engine

Defining the Engine

Adding Locals

Creating Templates

Rendering Templates in a Response

Summary

Next

19 Implementing Express Middleware

Understanding Middleware

Assigning Middleware Globally to a Path

Assigning Middleware to a Single Route

Adding Multiple Middleware Functions

Using the query Middleware

Serving Static Files

Handling POST Body Data

Sending and Receiving Cookies

Implementing Sessions

Applying Basic HTTP Authentication

Implementing Session Authentication

Creating Custom Middleware

Summary

Next

V: Learning Angular

20 Jumping into TypeScript

Learning the Different Types

Understanding Interfaces

Implementing Classes

Class Inheritance

Implementing Modules

Understanding Functions

Summary

Next

21 Getting Started with Angular

Why Angular?

Understanding Angular

Modules

Directives

Data Binding

Dependency Injection

Services

Separation of Responsibilities

Adding Angular to Your Environment

Using the Angular CLI

Generating Content with the CLI

Creating a Basic Angular Application

Creating Your First Angular App

Understanding and Using NgModule

Creating the Angular Bootstrapper

Summary

Next

22 Angular Components

Component Configuration

Defining a Selector

Building a Template

Using Inline CSS and HTML in Angular Applications

Using Constructors

Using External Templates

Injecting Directives

Building a Nested Component with Dependency Injection

Passing in Data with Dependency Injection

Creating an Angular Application that Uses Inputs

Summary

Next

23 Expressions

Using Expressions

Using Basic Expressions

Interacting with the Component Class in Expressions

Using TypeScript in Angular Expressions

Using Pipes

Using Built-in Pipes

Building a Custom Pipe

Creating a Custom Pipe

Summary

Next

24 Data Binding

Understanding Data Binding

Interpolation

Property Binding

Attribute Binding

Class Binding

Style Binding

Event Binding

Two-Way Binding

Summary

Next

25 Built-in Directives

Understanding Directives

Using Built-in Directives

Components Directives

Structural Directives

Attribute Directives

Summary

Next

VI: Advanced Angular

26 Custom Directives

Creating a Custom Attribute Directive

Creating a Custom Directive with a Component

Summary

Next

27 Events and Change Detection

Using Browser Events

Emitting Custom Events

Emitting a Custom Event to the Parent Component Hierarchy

Handling Custom Events with a Listener

Implementing Custom Events in Nested Components

Deleting Data in a Parent Component from a Child Component

Using Observables

Creating an Observable Object

Watching for Data Changes with Observables

Summary

Next

28 Implementing Angular Services in Web Applications

Understanding Angular Services

Using the Built-in Services

Sending HTTP GET and PUT Requests with the http Service

Configuring the HTTP Request

Implementing the HTTP Response Callback Functions

Implementing a Simple JSON File and Using the http Service to Access It

Implementing a Simple Mock Server Using the http Service

Implementing a Simple Mock Server and Using the http Service to Update Items on the Server

Changing Views with the router Service

Using routes in Angular

Implementing a Simple Router

Implementing a Router with a Navigation Bar

Implementing a Router with Parameters

Summary

Next

29 Creating Your Own Custom Angular Services

Integrating Custom Services into Angular Applications

Adding an Angular Service to an Application

Implementing a Simple Application that Uses a Constant Data Service

Implementing a Data Transform Service

Implementing a Variable Data Service

Implementing a Service that Returns a Promise

Implementing a Shared Service

Summary

Next

30 Having Fun with Angular

Implementing an Angular Application that Uses the Animation Service

Implementing an Angular Application that Zooms in on Images

Implementing an Angular Application that Enables Drag and Drop

Implementing a Star Rating Angular Component

Summary

Index

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.68.49