Index

Symbols

+ (addition) operator, 17

&& (and) operator, 19

= assignment operator, 18

+= assignment operator, 18

-= assignment operator, 18

/= assignment operator, 18

*= assignment operator, 18

%= assignment operator, 18

` (backquotes), 404405

{ } (curly braces), 20, 24, 415, 416, 429

/ (division) operator, 18

$ (dollar sign), 243

== (equal) operator, 19

=== (equal) operator, 19

' escape code, 29

" escape code, 29

\ escape code, 29

> (greater than) operator, 19

>= (greater than or equal to) operator, 19

++ (increment) operator, 18

< (less than) operator, 19

<= (less than or equal to) operator, 19

% (modulus) operator, 18

* (multiplication) operator, 18

! (not) operator, 19

!= (not equal) operator, 19

!== (not equal) operator, 19

|| (or) operator, 19

( ) (parentheses), 20, 24, 436, 457

| (pipe symbol), 426

- (subtraction) operator, 18

~ (tilde), 404405

A

abort() method, 120, 161

acceptsCharset property (Request object), 351

accessing MongoDB

access control, 209

authentication, 210211

Database Administrator accounts, 211

User Administrator accounts, 209210

from shell client, 203204

command parameters, 205

shell commands, 204

shell methods, 205

shell scripts, 205206

accounts (MongoDB)

Database Administrator accounts, 211

user accounts

creating, 206207

listing, 206207

removing, 209

roles, 208

User Administrator accounts, 209210

ActivatedRoute, importing, 488

$add operator, 286

addCensoredWords() function, 52

addClass() method, 446

$addFields operator, 285

addition (+) operator, 17

addListener() function, 65

AddNums interface, 385

address() method, 143, 146

addShard() method, 339

addShardTag() method, 340

addTagRange() method, 340

$addToSet operator, 243, 286

addTrailers() method, 122

addUser() method, 228, 229

admin() method, 227, 229

Admin object, 229

aggregate() method, 283, 301, 317

aggregating results, 282289

aggregate() method, 283

aggregation examples, 287289

aggregation expression operators, 285287

aggregation framework operators, 283285

aggregation expression operators, 285287

aggregation framework operators, 283285

AJAX (Asynchronous JavaScript and XML) requests, 9

alerts, asynchronous, 516

all() method, 304, 346

$all operator, 264

allowDrop() method, 536

allowHalfOpen option, 86, 145

and() method, 303

and (&&) operator, 19

$and operator, 263

Angular. See also Node.js-to-Angular stack

adding to environment, 393394

advantages of, 4, 1314, 391

applications, creating, 395396, 398402

Angular bootstrapper, 399402

animation application, 525529

component modules, importing, 396397

drag-and-drop application, 533539

NgModule, 397398

star rating application, 539546

zoom application, 530533

bootstrapper, 398402

app.module.js, 401

app.module.ts, 400

first.component.js, 402

first.component.ts, 400

first.html listing, 399

browser events, 457458

built-in directives, 441442

attribute directives, 392, 445448

components directives, 392, 442

structural directives, 392, 442445

change detection, 465468

CLI (command-line interface), 394395

components, 396397, 539546

Angular bootstrapper components, 398402

animation application components, 526529

collections, 204

configuration, 403404

constructors, 407

custom component directives, 452456

deleting data in, 461464

dependency injection, 392393, 410414

drag-and-drop application components, 534538

emitting custom events from, 458

image zoom application components, 530532

importing, 396397

inline CSS and HTML in, 405406

integrating custom services into, 503504

nested components, 458460

NgModule, 397398

selectors, 404

separation of responsibilities, 393

star rating application components, 539546

templates, 404405, 408410

custom directives, 449

custom attribute directives, 449452

custom component directives, 452456

custom events, 458

deleting data with, 461464

emitting from components, 458

handling with listeners, 458

implementing in nested components, 458460

data binding, 429

attribute binding, 433

class binding, 433434

definition of, 392

event binding, 436439

interpolation, 430431

property binding, 431433

style binding, 435436

two-way binding, 439440

definition of, 4

dependency injection, 392393

event binding, 436439

expressions, 415416

basic expressions, 416417

built-in pipes, 422426

Component class interaction, 418419

custom pipes, 426428

pipe implementation, 422

TypeScript in, 419422

modules, 392

observables

creating, 464465

definition of, 464

detecting data changes with, 465468

separation of responsibilities, 393

services

animate, 470

animation service, application using, 525529

area-calc.service.ts, 506510

constant data service, 505506

definition of, 393

forms, 470

http, 470486

integrating into applications, 503504

mock back-end service, 540541

purpose of, 469

ratings service, 541542

router, 470, 487501

service that returns a promise, 515516

shared service, 516523

use cases for, 503504

UserService, 483484

variable data service, 510514

TypeScript, 383

in Angular expressions, 419422

classes, 386

data types, 383384

directives, 462463

functions, 388389

inheritance, 387

interfaces, 385386

modules, 387388

Angular QuickStart website, 394

animate service, 470

animated component

animated.component.css, 529

animated.component.html, 529

animated.component.ts, 527528

animation application

animated.component.css, 529

animated.component.html, 529

animated.component.ts, 527528

app.component.html, 526527

app.component.ts, 526

app.module.ts, 525526

folder structure, 525

anonymous functions, 2526

any data type, 384

app.component.css listing

AreaCalcService, 509

custom directive with component, 454

drag-and-drop application, 535536

RandomImageService, 513514

router with navigation bar, 495

star rating application, 544

app.component.html listing

animation application, 526527

AreaCalcService, 508509

custom directive with component, 453454

drag-and-drop application, 535

image zoom application, 531

PiService, 506

PromiseService, 516

RandomImageService, 513

router with navigation bar, 494

SharedService, 519

star rating application, 543544

zoom directive, 451452

app.component.ts listing

animation application, 526

AreaCalcService, 507508

custom directive with component, 453

drag-and-drop application, 534535

image zoom application, 530531

PiService, 505

PromiseService, 515516

RandomImageService, 512513

router with navigation bar, 494

router with parameters, 498

SharedService, 519

simple router application, 490

star rating application, 543

append() method, 318

applications (Angular), 395396, 398402. See also components (Angular)

Angular bootstrapper

app.module.js, 401

app.module.ts, 400

first.component.js, 402

first.component.ts, 400

first.html, 399

animation application

animated.component.css, 529

animated.component.html, 529

animated.component.ts, 527528

app.component.html, 526527

app.component.ts, 526

app.module.ts, 525526

folder structure, 525

component modules, importing, 396397

drag-and-drop application

app.component.css, 535536

app.component.html, 535

app.component.ts, 534535

drag.component.css, 538

drag.component.html, 538

drag.component.ts, 538

drop.component.css, 537

drop.component.html, 537

drop.component.ts, 536

folder structure, 533534

NgModule, 397398

star rating application

app.component.css, 544

app.component.html, 543544

app.component.ts, 543

app.module.ts, 540

folder structure, 539

mockbackend.service.ts, 540541

rated-item.component.css, 545546

rated-item.component.html, 545

rated-item.component.ts, 544545

ratings.service.ts, 541542

zoom application

app.component.html, 531

app.component.ts, 530531

folder structure, 530

zoomit.component.css, 532

zoomit.component.html, 532

zoomit.component.ts, 531532

applications (Node.js), censorify module

censortext.js, 49

creating, 4950

loading into Node.js applications, 5253

package.json, 50, 51

publishing to NPM Registry, 5051

readwords.js, 52

app.module.js listing, 401

app.module.ts listing

Angular bootstrapper, 400

animation application, 525526

simple mock server implementation, 473474, 480

simple router implementation, 488489

star rating application, 540

AppRoutingModule, importing, 488

app-routing.module.ts listing

router with navigation bar, 492493

router with parameters, 498

simple router implementation, 489490

arbiter servers, 331

arch() method, 162, 182

AreaCalcService, 506510

app.component.css, 509

app.component.html, 508509

app.component.ts, 507508

area-calc.service.ts, 506507

area-calc.service.ts listing, 506507

argv method, 162

arithmetic operators, 1718

Array object, 3233

adding items to, 3435

combining, 3334

converting into strings, 34

iterating through, 34

manipulating, 3233

methods, 3233

removing items from, 3435

searching, 34

arrays, 16

JavaScript

adding items to, 3435

combining, 3334

converting into strings, 34

iterating through, 34

manipulating, 3233

methods, 3233

removing items from, 3435

searching, 34

Routes, defining, 486487

TypeScript, 384

assert() function, 54

assertion testing module, 40, 190

assigning Express middleware

globally to path, 368

to single route, 368

assignment operators, 18

async pipe, 424

asynchronous alerts, 516

asynchronous file reading, 104105

asynchronous file system calls, 95

asynchronous file writing, 99101

Asynchronous JavaScript and XML (AJAX), 9

atomic write operations, 198

atomically modifying documents, 250251

attachment() method, 353

attribute binding, 433

attribute directives, 392, 445448

attribute.component.css, 448

attribute.component.html, 447

attribute.component.ts, 446447

custom attribute directives, 449452

definition of, 441

ngForm, 445

ngModel, 445

ngStyle, 445

attribute.component.css listing, 448

attribute.component.html listing, 447

attribute.component.ts listing, 446447

--auth parameter (mongod command), 203

auth property (URL object), 116

authenticate() method, 228, 229

authentication

HTTP, 375377

MongoDB, 210211

session, 377380

author directive, 47

auto_reconnect option (server object), 224

autoIndex option (Schema object), 295

autoIndexID option (collections), 214

$avg operator, 286

B

 (backspace) escape code, 30

backend services, 10

backing up MongoDB, 341342

backquotes (`), 404405

backspace escape code, 30

Bad Guys component

badguys.component.css, 522

badguys.component.html, 522

badguys.component.ts, 521

base64 encoding, 75

basicAuth middleware, 368, 375377

basicExpressions.component.ts listing, 417

big endian, 75

bin directives, 47

--bind parameter (mongod command), 203

binding. See data binding

$bit operator, 244

blocking I/O, 5758

bodyParser middleware, 368, 371372

Boolean data type

JavaScript, 16

TypeScript, 383

bootstrap metadata option (NgModule), 397

bootstrapper (Angular), 398402

app.module.js, 401

app.module.ts, 400

first.component.js, 402

first.component.ts, 400

first.html listing, 399

border() function, 450

brackets ({ }), 415, 416

break statement, 2324

browser events, 457458

browser view, rendering, 910

BrowserAnimationsModule, loading, 526

browsers, 8

browser events, 457458

browser view, rendering, 910

browser-to-webserver communication, 89

user interaction, 10

browser-to-webserver communication, 89

BSON, 192

$bucket operator, 285

$bucketAuto operator, 285

buffer module. See buffers

buffer_concat.js listing, 81

buffer_copy.js listing, 79

buffer_read.js listing, 78

buffer_slice.js listing, 80

buffer_write.js listing, 77

bufferCommands option (Schema object), 295

buffers, 7475

compressing/decompressing, 9192

concatenating, 81

copying, 7980

creating, 7576

determining length of, 78

encoding methods, 75

reading from, 7778

slicing, 80

writing to, 7677

bufferSize property (Socket object), 143

building templates, 404405

built-in directives, 441442

attribute directives, 392, 445448

attribute.component.css, 448

attribute.component.html, 447

attribute.component.ts, 446447

definition of, 441

ngForm, 445

ngModel, 445

ngStyle, 445

components directives, 392, 441, 442

structural directives, 392, 442445

definition of, 441

ngFor, 442, 474, 479, 484, 513

ngIf, 442443

ngSwitch, 442443

ngSwitchCase, 442, 443

ngSwitchDefault, 442

structural.component.ts, 443444

built-in events, 457458

built-in pipes

builtInPipes.component.ts, 425

table of, 422424

built-in services

animate, 470

forms, 470

http, 470

GET requests, sending, 470471

JSON file implementation and access, 472475

PUT requests, sending, 470471

request configuration, 471

response callback functions, 471

simple mock server implementation, 475481

simple mock server updates, 481486

router, 470

ActivatedRoute, importing, 488

route navigation, 488

route object parameters, 487

Router, importing, 488

router with navigation bar, 492497

router with parameters, 497501

Routes array, 486487

routing module, including, 488

simple router implementation, 488491

builtInPipes.component.ts listing, 425

byteLength() method, 78

bytesRead property (Socket object), 144

bytesWritten property (Socket object), 144

C

ca option

htp.createServer(), 136

https.request(), 136

tls.connect(), 154

tls.createServer(), 155

callback functions, 67

applying for defined parameters, 348349

chaining, 70

implementing closure in, 6869

passing parameters to, 6768

callback_chain.js listing, 70

callback_closure.js listing, 69

callback_parameter.js listing, 6768

canActivate property (route object), 487

canActivateChild property (route object), 487

canDeactivate property (route object), 487

canLoad property (route object), 487

capped collections, 197198, 330

capped option

collections, 214

Schema object, 295

carriage return escape code, 29

Cascading Style Sheets. See CSS (Cascading Style Sheets)

case sensitive routing setting (Express), 344

catch() method, 471

catch statement, 3536

C/C++ add-ons, 40, 190

censor() function, 52

censorify module

censortext.js, 49

creating, 4950

loading into Node.js applications, 5253

package.json, 50, 51

publishing to NPM Registry, 5051

readwords.js, 52

censortext.js listing, 49

cert option

htp.createServer(), 136

https.request(), 136

tls.connect(), 154

certificate class, 188

chaining callback functions, 70

change detection, 465468

(change) event, 457

changeLoop() method, 510

changeSize() function, 450

character.component.css listing, 462

character.component.html listing, 462

character.component.ts listing, 461462

charAt() method, 30

charCodeAt() method, 30

charObservable, 517

chdir() method, 162

checkContinue event, 124

checkGoal() function, 66

checkKeys option, 242

child components, deleting parent data from, 461464

child forks, 171173

child processes, 159160

child forks, 171173

ChildProcess object, 164166

executable files, executing on another process, 168169

processes, spawning, 169171

system command, executing on another process, 166168

child_exec.js listing, 167168

child_fork.js listing, 172173

child_process module, 40, 159160

child forks, 171173

ChildProcess object, 164166

executable files, executing on another process, 168169

processes, spawning, 169171

system command, executing on another process, 166168

child_process_exec_file.js listing, 168169

child_process_spawn_file.js listing, 170171

ChildProcess object, 164166

Children property (route object), 487

cipher class, 188

ciphers option

htp.createServer(), 136

https.request(), 136

tls.createServer(), 155

class binding, 433434

class.component.ts listing, 434

classes. See also services (Angular)

binding, 433434

certificate, 188

cipher, 188

Component, 418419

decipher, 188

defining, 386

diffieHellman, 188

@directive, 449

eCDH, 188

EventEmitter, 458

export classes

Directive, 449

ZoomDirective, 451

hash, 189

hmac, 189

inheritance, 387

MongoClient, 222

pipe, 426

SecretAgent, 387

sign, 189

verify, 189

classExpressions.component.ts listing, 418419

clearCookie() method, 373

clearImmediate() function, 62

clearInterval() function, 61

clearTimeout() function, 60

CLI (command-line interface), 394395. See also commands

(click) event, 457

clientError event, 124, 156

ClientRequest object, 118121

clients

HTTPS clients, 135136

TCP socket clients, 147150

TLS socket clients, 153154

client-side scripts, 9

close event, 82, 121, 123, 124, 142, 145, 165

close() method, 97, 125, 146, 227, 233

closeSync() method, 97

closing files, 9697

closure in callback functions, 6869

cluster module, 40, 174

events, 174

HTTP clusters, 176179

methods, 175

properties, 175

Worker object, 175176

cluster_server.js listing, 177179

clusterAdmin role (MongoDB), 208

clusters

cluster module, 40, 174

events, 174

HTTP clusters, 176179

methods, 175

properties, 175

Worker object, 175176

sharded MongoDB clusters, 338

adding shards to cluster, 339

config server database instances, 338

query router servers, 338339

code listings. See listings

collection() method, 228, 230

Collection object, 229232. See also collections (MongoDB)

collection option (Schema object), 295

collection_create_list_delete.js listing, 238239

collection_stat.js listing, 239240

collectionInfo() method, 227

collectionNames() method, 227

collections (MongoDB)

capped collections, 197198, 330

Collection object, 229232

collection_create_list_delete.js application example, 238239

creating, 214215, 237

definition of, 192

deleting, 215216, 238

displaying list of, 214

documents

adding, 217, 244246, 307309

aggregating with Mongoose, 317320

atomically modifying, 250251

counting, 268269

Document object, 304305

finding, 216, 265268, 305307

removing, 217218, 255258, 314317

retrieving, 246248

saving, 252253, 310311

updating, 218219, 248250, 309314

upserting, 253254

listing, 237

number of, 199

sharding on, 340

statistics for, 239240

collections command, 204

collections() method, 228, 237

$collStatus operator, 284

combining

arrays, 3334

strings, 31

command-line interface, 394395. See also commands

command-line options module, 40

commands. See also directives

databases, 204

db.help, 204

dbs, 204

executing in another process, 166168

exit, 204

help, 204

mongod, 202203

mongodump, 342

ng eject, 395

ng generate component, 395

ng generate directive, 395

ng generate enum, 395

ng generate guard, 395

ng generate interface, 395

ng generate module, 395

ng generate pipe, 395

ng generate service, 395

ng new, 395

ng serve, 395

npm, 42, 4445

npm adduser, 50

npm install, 46, 51

npm pack, 50

npm search, 45

npm install, 475

profile, 204

roles, 204

show, 204

use, 204

users, 204

comment() method, 302

comment option (options object), 265

communication, browser-to-webserver, 89

comparison operators, 1920

compatibility of Angular, 14

compiling models, 298

Component class, 418419

component directives, 441

component property (route object), 487

components (Angular), 396397, 539546. See also services (Angular)

Angular bootstrapper, 398402

animation application, 526527

animated.component.css, 529

animated.Component.html, 529

animated.component.ts, 527528

app.component.ts, 526

app.module.ts, 525526

folder structure, 525

collections, 204

configuration, 403404

constructors, 407

custom component directives, 452456

container component, 454

CSS for container component, 455

CSS for root component, 454

HTML for container component, 455

HTML for root component, 453454

root component, 453

deleting data in, 461464

dependency injection

building nested components with, 410412

definition of, 392393, 410

passing data with, 412413

sample application with inputs, 413414

drag-and-drop application

app.component.css, 535536

app.component.html, 535

app.component.ts, 534535

drag.component.css, 538

drag.component.html, 538

drag.component.ts, 538

drop.component.css, 537

drop.component.html, 537

drop.component.ts, 536

folder structure, 533534

emitting custom events from, 458

image zoom application

app.component.html, 531

app.component.ts, 530531

folder structure, 530

zoomit.component.css, 532

zoomit.component.html, 532

zoomit.component.ts, 531532

importing, 396397

inline CSS and HTML in, 405406

integrating custom services into, 503504

nested components, 458460

NgModule, 397398

selectors, defining, 404

separation of responsibilities, 393

star rating application

app.component.css, 544

app.component.html, 543544

app.component.ts, 543

app.module.ts, 540

folder structure, 539

mockbackend.service.ts, 540541

rated-item.component.css, 545546

rated-item.component.html, 545

rated-item.component.ts, 544545

ratings.service.ts, 541542

templates

building, 404405

external templates, 408410

components directives, 392, 442

compound indexes, 328

compress middleware, 368

compressing

buffers, 9192

streams, 9293

concat() method, 30, 31, 3334, 81

$concat operator, 287

concatenating buffers, 81

conditionals

if statements, 20

switch statements, 2021

config method, 161

--config parameter (mongod command), 202

config servers, creating, 338

configuration

components, 403404

selectors, 404

templates, 404405

Express, 343344

HTTP requests, 471

MongoDB authentication, 210211

query database operation, 299302

connect event, 120, 124, 141

connect() method, 56, 140, 147, 154, 223, 292

connected property (ChildProcess object), 166

connecting to MongoDB

MongoClient class, 222

MongoClient object, 223226

Mongoose, 292294

write concern, 222

connection event, 124, 145

Connection object, 292293

connectionTimeOut option (server object), 224

console, writing data to, 5354

console module, 40, 5354

constant data service, 505506

app.component.html, 506

app.component.ts, 505

pi.service.ts, 505

constructor.component.ts listing, 407

constructors, 407

container component, 454

CSS for, 455

HTML for, 455

container directive

container.component.css, 455

container.component.html, 455

container.component.ts, 454

content, generating with CLI (command-line interface), 394395

continue event, 120

continue statement, 2324

contributors directive, 47

converting

arrays to strings, 34

JavaScript objects to JSON, 74

JSON to JavaScript objects, 74

objects to strings, 184185

cookie() method, 373, 378

cookieParser middleware, 368, 373374

cookies

cookie sessions, 374375

sending/receiving, 373374

cookieSession middleware, 368, 374375

copy() method, 79

copyDatabase() method, 213

copying

buffers, 7980

databases, 213

count() method, 231, 233, 268269, 300

$count operator, 285

counting documents, 268269

cpus() method, 182

create() method, 300, 307

createAlert() method, 515

createCollection() method, 214, 228, 234, 237, 330

createConnection() method, 140

createDb() method, 481

createDelete.component.CSS listing, 479480

createDelete.component.html listing, 479

createDelete.component.ts listing, 477478

createReadStream() method, 105106

createServer() method, 124, 126, 128, 136, 150, 154156, 345

createTimedAlert() method, 515

createUser() method, 207, 208, 476, 478

createWriteStream() method, 101102

crl option

htp.createServer(), 136

https.request(), 136

tls.createServer(), 155

crypto module, 41, 188190

csrf middleware, 368

CSS (Cascading Style Sheets)

files, 9

inline CSS in Angular applications, 405406

listings

app.component.css, 454, 495, 513514, 535536, 544

attribute.component.css, 448

character.component.css, 462

container.component.css, 455

details.component.css, 463

drag.component.css, 538

drop.component.css, 537

external.css, 409

http.component.CSS, 474475

outer.css, 411

rated-item.component.css, 545546

./static/css/static.css, 370

update.component.CSS, 485486

zoomit.component.css, 532

curly braces ({ }), 20, 24, 429

currency pipe, 423

current database, changing, 211212

Cursor object, 232233

custom Angular services, 503

constant data service, 505506

app.component.html, 506

app.component.ts, 505

pi.service.ts, 505

data transform service, 506510

app.component.css, 509

app.component.html, 508509

app.component.ts, 507508

area-calc.service.ts, 506507

integrating into applications, 503504

mock back-end service, 540541

ratings service, 541542

service that returns a promise, 515516

shared service, 516523

app.component.html, 519

app.component.ts, 519

badguys.component.css, 522

badguys.component.html, 522

badguys.component.ts, 521

good-guys.component.css, 521

good-guys.component.html, 520

good-guys.component.ts, 520

shared.service.ts, 517518

use cases for, 503504

variable data service, 510514

app.component.css, 513514

app.component.html, 513

app.component.ts, 512513

random-image.service.ts, 511512

custom directives, 449

custom attribute directives, 449452

custom component directives, 452456

container component, 454

CSS for container component, 455

CSS for root component, 454

HTML for container component, 455

HTML for root component, 453454

root component, 453

custom events, 6465, 457

deleting data with, 461464

emitting from components, 458

handling with listeners, 458

implementing in nested components, 458460

custom middleware, 380381

custom pipes, 426428

custom-defined objects, 28

customevent.component.html listing, 459460

customevent.component.ts listing, 459

customPipes.component.ts listing, 427

custom.pipe.ts listing, 427

cwd() method, 162

cwd property

exec() and execFile() methods, 166

fork() function, 172

spawn() function, 170

D

Dahl, Ryan, 39

data binding, 429

attribute binding, 433

class binding, 433434

definition of, 392

event binding, 436439

interpolation, 430431

property binding, 431433

style binding, 435436

two-way binding, 439440

data changes, detecting with observables, 465468

data denormalization, 196197

data event, 82, 141

data I/O

buffers, 7475

compressing/decompressing, 9192

concatenating, 81

copying, 7980

creating, 7576

determining length of, 78

encoding methods, 75

reading from, 7778

slicing, 80

writing to, 7677

JSON (JavaScript Object Notation), 73

converting JavaScript objects to, 74

converting to JavaScript objects, 74

streams, 81

compressing/decompressing, 9293

Duplex streams, 8688

piping, 8990

Readable streams, 8284, 8990

Transform streams, 8889

Writable streams, 8486, 8990

data life cycles, 199

data model, planning, 194195

data normalization, 195196

data passing with dependency injection, 412413

Data property (route object), 487

data transform service, 506510

app.component.css, 509

app.component.html, 508509

app.component.ts, 507508

area-calc.service.ts, 506507

data types

JavaScript, 1617

MongoDB, 193194

TypeScript, 383384

data usability, 200

Database Administrator accounts, 211

databases (MongoDB). See also collections (MongoDB)

changing current, 211212

connecting to using Mongoose, 292294

copying, 213

creating, 212, 234

database change options, 241242

db_create_list_delete.js sample application, 234236

deleting, 212213, 234

displaying list of, 211

implementing schemas on, 295296

listing, 233

query database operation

options, 301302

setting, 299301

repairing, 341

update operators, 242244

databases command, 204

data.service.ts listing, 476, 481482

date pipe, 423

db() method, 227

Db object, 227228

db_connect_object.js listing, 226

db_connect_url.js listing, 225

db_create_list_delete.js listing, 234236

db_status.js listing, 236237

dbAdmin role (MongoDB), 208

dbAdminAnyDatabase role (MongoDB), 208

db.auth() method, 205

db.help command, 204

--dbpath parameter (mongod command), 203

dbs command, 204

debounce() method, 471

debugger module, 41

decipher class, 188

declarations metadata, 397, 410

decompressing

buffers, 9192

streams, 9293

decorators

@NgModule, 397398, 410

@pipe, 426

defined parameters, applying route parameters with, 348

deflate() method, 91

deflateRaw() method, 91

delaying work

interval timers, 6162

timeout timers, 6061

delete() method, 470

deleteChar() method, 461

deleteUser() method, 476, 478

deleting data, 461464

array items, 3435

collections, 215216, 238

databases, 212213

directories, 111112

documents, 217218

findAndRemove() method, 257258

with Mongoose, 314317

remove() method, 217218, 255256

event listeners, 65

files, 110

MongoDB user accounts, 209

denormalizing data, 196197

dependencies directive, 48

dependency injection

building nested components with, 410412

definition of, 392393, 410

passing data with, 412413

sample application with inputs, 413414

deploying

replica sets, 333334

sharded MongoDB clusters, 338

adding shards to cluster, 339

config server database instances, 338

query router servers, 338339

dereferencing timers, 63

description directive, 47

destroy() method, 142, 378

detached property (spawn() function), 170

details.component.css listing, 463

details.component.html listing, 463

details.component.ts listing, 462463

detecting data changes, 465468

diffieHellman class, 188

dir() function, 53

@directive class, 449

Directive class, 449

directives. See also commands

author, 47

bin, 47

built-in directives, 441442

attribute directives, 392, 445448

components directives, 392, 442

structural directives, 392, 442445

contributors, 47

custom directives, 449

custom attribute directives, 449452

custom component directives, 452456

definition of, 441

dependencies, 48

description, 47

engines, 48

keywords, 48

main, 47

name, 47

preferGlobal, 47

repository, 48

scripts, 47

version, 47

directories

creating, 111112

deleting, 111112

node_modules, 221

renaming, 112

disable() method, 344

disabled() method, 344

disconnect event, 165, 174, 176

disconnect() method, 165, 175, 176, 292

distinct field values, finding, 276277

distinct() method, 231, 276277, 300

$divide operator, 286

division (/) operator, 18

dns module, 41, 186188

dns_lookup.js listing, 187188

doc_aggregate.js listing, 288

doc_count.js listing, 268269

doc_delete_one.js listing, 257258

doc_delete.js listing, 255256

doc_distinct.js listing, 277

doc_fields.js listing, 271272

doc_find.js listing, 247248

doc_group.js listing, 279280

doc_insert.js listing, 245246

doc_limit.js listing, 270271

doc_modify.js listing, 251

doc_paging.js listing, 273274

doc_query.js listing, 266268

doc_save.js listing, 252253

doc_sort.js listing, 275276

doc_update.js listing, 249250

doc_upsert.js listing, 253254

doCalc() function, 26

doCircle() method, 507

Document object, 292, 304305

Document Object Model. See DOM (Document Object Model)

documents (MongoDB)

adding

insert() method, 217, 244246

with Mongoose, 307309

aggregating with Mongoose, 317320

atomically modifying, 250251

counting, 268269

data denormalization, 196197

data normalization, 195196

embedded documents, 196197

finding

find() method, 216

with Mongoose, 305307

sets of documents, 265268

getting from collections, 246248

growth of, 198

Mongoose Document object, 304305

paths, 294

references, 195196

removing

findAndRemove() method, 257258

with Mongoose, 314317

remove() method, 217218, 255256

saving

with Mongoose, 310311

save() method, 252253

structure of, 192193

TTY (time-to-live), 199

updating

findAndRemove() method, 218219

with Mongoose, 311314

update() method, 248250

upserting, 253254

dollar sign, 243

DOM (Document Object Model), 9

doRectangle() method, 507

doSquare() method, 507

doTrapezoid() method, 507

doTriangle() method, 507

double curly braces ({{}}), 429

do/while loops, 22

download responses, sending, 359

downloading MongoDB, 202

drag-and-drop application

app.component.css, 535536

app.component.html, 535

app.component.ts, 534535

drag.component.css, 538

drag.component.html, 538

drag.component.ts, 538

drop.component.css, 537

drop.component.html, 537

drop.component.ts, 536

folder structure, 533534

drag-item component

app.component.css, 535536

app.component.html, 535

app.component.ts, 534535

drag.component.css, 538

drag.component.html, 538

drag.component.ts, 538

drain event, 84, 142

driver. See MongoDB Node.js driver

drop() method, 215, 232

dropCollection() method, 228, 238

dropDatabase() method, 213, 228, 234

drop-item component

app.component.css, 535536

app.component.html, 535

app.component.ts, 534535

drop.component.css, 537

drop.component.html, 537

drop.component.ts, 536

dropping. See deleting data

dummyDB.JSON listing, 472

Duplex streams, 8688

dynamic GET servers, 127129

E

each() method, 232

$each operator, 244

eCDH class, 188

EJS template

creating, 361363

implementing, 363364

elements of arrays, adding/removing, 3435

$elemMatch, 266

elemMatch() method, 304

$elemMatch operator, 264

embedded documents, 196197

emit() method, 64, 458

emitter_listener.js listing, 6667

emitting custom events, 458

enable() method, 344

enabled() method, 344

enableSharding() method, 339340

encoding methods, 75

encoding property

exec() method, 167

execFile() method, 167

fork() function, 172

encrypt_password.js listing, 189

end event, 82, 141

end() method, 85, 120, 122, 127, 142

endian, 75

endianness() method, 181

engine() method, 360

engines, template, 360

defining, 360361

locals, adding, 361

rendered templates, sending, 363364

template creation, 361363

engines directive, 48

ensureIndex() method, 329

entryComponents metadata option (NgModule), 397

enum data type, 384

env method, 162

env property

exec() and execFile() methods, 166

fork() function, 172

spawn() function, 170

env setting (Express), 344

environment, adding Angular to, 393394

$eq operator, 263

equal sign (=), 18

equality operators, 19

equals() method, 304

error event, 82, 142, 145, 165, 176

error() function, 53

error handling, 35

finally keyword, 3637

throwing errors, 36

try/catch blocks, 3536

errors module, 41

errors property (Document object), 305

escape codes, 2930

event binding, 436439

event listeners

adding to objects, 65

implementing, 6567

removing from objects, 65

event queue, scheduling work on, 5960

event.component.ts listing, 436438

EventEmitter object, 6465, 458

eventHandler() method, 459

events, 5556

binding, 436439

blocking I/O, 5758

browser events, 457458

callbacks, 67

chaining, 70

implementing closure in, 6869

passing parameters to, 6768

ClientRequest object, 120

cluster module, 174

conversation metaphor, 5759

custom events, 6465, 458

deleting data with, 461464

emitting from components, 458

handling with listeners, 458

implementing in nested components, 458460

event callbacks, 5556

event listeners

adding to objects, 65

implementing, 6567

removing from objects, 65

event queue, scheduling work on, 5960

IncomingMessage object, 123

process signals, 160

Readable streams, 82

Server object, 124, 145

ServerResponse object, 121

Socket object, 141142

threaded models, 5556

Worker object, 176

Writable streams, 84

events module, 41. See also events

exec() method, 166168, 318

execArgv method, 162

execFile() method, 168169

execPath method, 162

execPath property (fork() function), 172

executable files, executing on another process, 168169

executables

mongod.exe, 202

Node.js executables, verifying, 4243

executing

executable files on another process, 168169

processes, 161

system commands on another process, 166168

exist event, 165

exists() method, 106107, 303

$exists operator, 263

existsSync() method, 106107

exit command, 204

exit event, 174, 176

exit() method, 161

explain option (options object), 264

export classes

Directive, 449

ZoomDirective, 451

export keyword, 392

exporting modules, 392

exports metadata option (NgModule), 397

Express, 13, 343

configuring, 343344

installing, 343

middleware, 367368

assigning globally to path, 368

assigning to single route, 368

basicAuth, 368, 375377

bodyParser, 368, 371372

compress, 368

cookieParser, 368, 373374

cookieSession, 368, 374375

csrf, 368

custom, 380381

favicon, 367

functions, 369

logger, 367

query, 368, 369

session, 368, 377380

static, 367, 369371

Request objects, 350352

Response objects, 352

download responses, 359

files in, 356358

headers, 352353

JSON responses, 355357

redirection, 359

rendered templates in, 363364

sending, 353355

status, 353

routes

applying parameters in, 347350

definition of, 345

implementing, 346

server, starting, 345

template engines, 360

defining, 360361

locals, adding, 361

rendered templates, sending, 363364

template creation, 361363

express_auth_one.js listing, 376

express_auth_session.js listing, 378379

express_auth.js listing, 376

express_cookies.js listing, 373374

express_http_https.js listing, 345

express_json.js listing, 356

express_middleware.js listing, 381

express_post.js listing, 372

express_redirect.js listing, 359

express_request.js listing, 351

express_routes.js listing, 349350

express_send_file.js listing, 358

express_send.js listing, 354

express_session.js listing, 374375

express_static.js listing, 370

express_templates.js listing, 363364

expressions, 415416

basic expressions, 416417

Component class interaction, 418419

pipes

built-in pipes, 422426

custom pipes, 426428

definition of, 422

TypeScript in, 419422

extensibility

of Angular, 14

of Node.js, 3, 12

external sources, interacting with, 132134

external templates, 408410

external.component.ts listing, 409

external.css listing, 409

externalTemplate.html listing, 409

F

f (form feed) escape code, 30

--f parameter (mongod command), 202

$facet operator, 285

@fadeState, 527529

favicon middleware, 367

feed() function, 386

fields

distinct field values, finding, 276277

limiting results by, 271272

naming conventions, 193

required fields, forcing, 296

unique fields, 296

fields option (options object), 264

file system, 41, 95

asynchronous file system calls, 95

directories

creating, 111112

deleting, 111112

renaming, 112

files

deleting, 110

listing, 108110

opening/closing, 9697

reading, 102106

renaming, 112

returning statistics about, 107108

truncating, 110111

verifying path of, 106107

watching for file changes, 112113

writing, 97102

synchronous file system calls, 95

file_read_async.js listing, 105

file_read_stream.js listing, 106

file_read_sync.js listing, 103104

file_readdir.js listing, 109110

file_read.js listing, 102103

file_stats.js listing, 108

file_write_async.js listing, 100101

file_write_stream.js listing, 101

file_write_sync.js listing, 99

file_write.js listing, 98

files. See also listings

deleting, 110

executing in another process, 168169

listing, 108110

node, 42

opening/closing, 9697

package.json file, 4748

reading

asynchronous file reading, 104105

simple file read, 102103

streamed file reading, 105106

synchronous file reading, 103104

renaming, 112

returning statistics about, 107108

sending in responses, 356358

static files, serving, 125127, 369371

truncating, 110111

verifying path of, 106107

watching for file changes, 112113

writing

asynchronous file writing, 99101

simple file write, 98

streaming file writing, 101102

synchronous file writing, 9899

fill() method, 76

finally keyword, 3637

find() method, 216, 231, 246248, 265268, 299, 300, 306

findAndModify() method, 231, 250251

findAndRemove() method, 231, 257, 300

findOne() method, 231, 246248, 300, 305

findOneAndUpdate() method, 301

finish event, 84

$first operator, 286

first.component.js listing, 402

first.component.ts listing, 400

first.html listing, 399

flush() method, 88

(focus) event, 457

folders, node_modules, 42

forceServerObjectId option, 242

forcing required fields, 296

for/in loops, 23

fork event, 174

fork() method, 171173

forks, 171173

for loops, 2223

form feed escape code, 30

form parameters, processing, 117118

format() method, 183184

formatGreeting() function, 25

formatting strings, 183184

forms service, 470

frameworks. See Angular; Node.js

freemem() method, 182

fresh property (Request object), 351

fromCharCode() method, 30

fs module. See file system

fsync option, 242

functions, 24. See also individual functions (for example, doCalc() function)

anonymous functions, 2526

callback functions, 67

applying for defined parameters, 348349

chaining, 70

implementing closure in, 6869

passing parameters to, 6768

defining, 24

passing variables to, 2425

returning values from, 25

TypeScript functions, 388389

G

generating content with CLI (command-line interface), 394395

$geoNear operator, 285

geospatial indexes, 328

get() method, 304, 344, 352, 470

GET requests

definition of, 9

dynamic GET servers, 127129

response callback functions, 471

sending, 470471

GET servers, 127129

getCensoredWords() function, 52

getCharacters() method, 517

getConnections() method, 146

GetData requests, 5556

GetFile requests, 5556

getgid() method, 162

getgroups() method, 163

getHeader() method, 122

getItems() method, 541

getObservable() method, 541, 543

getPi() method, 505

getRandom() function, 510

getRandomImage() method, 512

getSiblingDB() method, 212

getStarClass() method, 544545

getuid() method, 162

getUsers() method, 476, 482

getWeather() function, 132

gid property (spawn() function), 170

global module, 41, 190

Good Guys component

good-guys.component.css, 521

good-guys.component.html, 520

good-guys.component.ts, 520

gotoPage2() function, 498499

$graphLookup operator, 285

greater than (>) operator, 19

greater than or equal to (>=) operator, 19

greeting() function, 25

group() method, 277282, 318

$group operator, 284

grouping results, 277282

growth of MongoDB documents, 198

gt() method, 303

$gt operator, 263

gte() method, 303

$gte operator, 263

gunzip() method, 91

gzip() method, 91

H

handshakeTimeout option (tls.createServer), 155

hash class, 189

hash property (URL object), 117

hash-based sharding, 337

hashed indexes, 329

head() method, 470

headers, 10, 352353

headers property (IncomingMessage object), 123

headersSent event, 121

help command, 204

--help parameter (mongod command), 202

Hex encoding, 75

high availability, 3, 13

hint() method, 302

hint option (options object), 264

hitCharacter() method, 517520

hmac class, 189

home.component.html listing, 490

home.component.ts listing, 490

honorCipherOrder option (tls.createServer), 155

host property

ClientRequest object, 119

URL object, 116

hostname() method, 181

hostname property

ClientRequest object, 119

Request object, 351

URL object, 116

href property (URL object), 116

hrtime() method, 162

HTML (Hypertext Markup Language)

events, Angular syntax for, 457458

files, 9

inline HTML in Angular applications, 405406

listings

animated.Component.html, 529

app.component.html. See app.component.html listing

app.module.ts, 480

attribute.component.html, 447

badguys.component.html, 522

character.component.html, 462

container.component.html, 455

createDelete.component.html, 479

customevent.component.html, 459460

details.component.html, 463

drag.component.html, 538

drop.component.html, 537

externalTemplate.html, 409

first.html, 399

good-guys.component.html, 520

home.component.html, 490

http.component.html, 474

observable.component.html, 467

outer.html, 411

page1.component.html, 499

page2.component.html, 496, 500

page3.component.html, 496

rated-item.component.html, 545

route2.component.html, 491

update.component.html, 484485

user_ejs.html, 362

zoomit.component.html, 532

router-outlet tag, 488

HTTP (Hypertext Transfer Protocol), 8, 115. See also http service

authentication, 375377

clusters, 176179

headers, 10

HTTPS, 8, 134135

certificate signing request files, 135

HTTPS clients, 135136

HTTPS servers, 137

private keys, 135

query string and form parameter processing, 117118

requests, 9

ClientRequest object, 118121

methods, 350352

POST, 371372

properties, 350352

responses, 352

download responses, 359

files in, 356358

headers, 352353

IncomingMessage object, 122123

JSON responses, 355357

redirecting, 359

rendered templates in, 363364

sending, 353355

ServerResponse object, 121122

status, 353

servers

dynamic GET servers, 127129

external sources, interacting with, 132134

POST servers, 130131

Server object, 123125

static files, serving, 125127

URLs (Uniform Resource Locators)

resolving, 117

structure of, 115116

URL object, 116117

http module. See HTTP (Hypertext Transfer Protocol)

http service, 470

GET requests, sending, 470471

JSON file implementation and access, 472475

app.module.ts, 473474

dummyDB.JSON, 472

http.component.CSS, 474475

http.component.html, 474

http.component.ts, 473

PUT requests, sending, 470471

request configuration, 471

response callback functions, 471

simple mock server implementation, 475481

app.module.ts, 480

createDelete.component.CSS, 479480

createDelete.component.html, 479

createDelete.component.ts, 477478

creating, 475

data.service.ts, 476

user.service.ts, 478479

simple mock server updates, 481486

data.service.ts, 481482

update.component.CSS, 485486

update.component.html, 484485

update.component.ts, 482483

user.service.ts, 483484

http_client_get.js listing, 128

http_client_post.js listing, 131

http_client_static.js listing, 126127

http_server_external listing, 132133

http_server_get.js listing, 128

http_server_post.js listing, 130

http_server_static.js listing, 126

http.component.CSS listing, 474475

http.component.html listing, 474

http.component.ts listing, 473

HttpModule, importing, 473474

https module, 41, 134135

certificate signing request files, 135

HTTPS clients, 135136

HTTPS servers, 137

private keys, 135

httpVersion property (IncomingMessage object), 123

Hypertext Markup Language. See HTML (Hypertext Markup Language)

Hypertext Transfer Protocol. See HTTP (Hypertext Transfer Protocol)

I

_id indexes, 327328

id metadata option (NgModule), 397

id property

Document object, 304

Schema object, 295

Worker object, 176

IDE (Integrated Development Environment), 43

if statements, 20

imageClick() function, 532

images

animation application

animated.component.css, 529

animated.Component.html, 529

animated.component.ts, 527528

app.component.html, 526527

app.component.ts, 526

app.module.ts, 525526

drag-and-drop application

app.component.css, 535536

app.component.html, 535

app.component.ts, 534535

drag.component.css, 538

drag.component.html, 538

drag.component.ts, 538

drop.component.css, 537

drop.component.html, 537

drop.component.ts, 536

folder structure, 533534

image zoom application

app.component.html, 531

app.component.ts, 530531

folder structure, 530

zoomit.component.css, 532

zoomit.component.html, 532

zoomit.component.ts, 531532

immediate timers, 62

import keyword, 392

importing

modules, 392

ActivatedRoute, 488

AppRoutingModule, 488

Component, 396397

HttpModule, 473474

InMemoryDbService, 476, 481

InMemoryWebApiModule, 480481

NgModule, 397398

Router, 488, 492

Observable object, 510512

imports metadata option (NgModule), 397

$inc operator, 243

IncomingMessage object, 122123

increment (++) operator, 18

index() method, 295296

indexed arrays, 384

indexes, 198199

adding to schemas, 295296

creating, 327330

indexes() method, 296

indexOf() method, 30, 31, 33, 34

indexOptionsDefaults option (collections), 215

$indexStats operator, 285

inflate() method, 91

inflateRaw() method, 91

info() function, 53

inheritance, 387

inherits() method, 83, 185186

initgroups() method, 163

inline CSS and HTML, 405406

InMemoryDbService, importing, 476, 481

InMemoryWebApiModule

implementing, 540

importing, 480481

in() method, 303

inner.component.ts listing, 412

$in operator, 263

Input decorator, 412

input.component.ts listing, 413414

insert() method, 217, 230, 244246

inspect() method, 184185

installing

Express, 343

MongoDB, 201202

Node.js, 42

NPMs (Node Packaged Modules), 46

Integrated Development Environment (IDE), 43

interface keyword, 385

interfaces

Person, 385

PersonInterface, 386

RatedItem, 541

Stringy, 385

TypeScript, 385386

interpolation, 430431

interpolation.component.ts listing, 430431

interrupting loops, 2324

interval timers, 6162

intro.ts listing, 406

invalidate() method, 305

I/O

blocking, 5758

pipes, 159160

ip property (Request object), 351

isClosed() method, 233

isInit() method, 305

isinstanceof operator, 184

isMaster property (cluster module), 175

isModified() method, 305

isNew property (Document object), 305

isSelected() method, 305

isWorker property (cluster module), 175

iterating through arrays, 34

J

JavaScript, 15. See also listings

arrays

adding items to, 3435

combining, 3334

converting into strings, 34

iterating through, 34

manipulating, 3233

methods, 3233

removing items from, 3435

searching, 34

conditionals

if statements, 20

switch statements, 2021

data types, 1617

error handling, 35

finally keyword, 3637

throwing errors, 36

try/catch blocks, 3536

functions, 24. See also individual functions (for example, doCalc() function)

anonymous functions, 2526

callback functions, 6770, 348349

defining, 24

passing variables to, 2425

returning values from, 25

JSON (JavaScript Object Notation), 73

converting JavaScript objects to, 74

converting to JavaScript objects, 74

keywords

export, 392

finally, 3637

import, 392

new, 27

styles, 405

styleUrls, 408

templateUrl, 408

var, 1516

loops, 21

do/while, 22

for, 2223

for/in, 23

interrupting, 2324

while, 21

methods, 27. See also individual methods (for example, write() method)

objects, 27

Array, 3233

converting JSON to, 74

converting to JSON, 74

custom events, 6465

custom-defined objects, 28

prototyping object patterns, 29

String, 2931

syntax, 2728

operators, 17

arithmetic operators, 1718

assignment operators, 18

comparison operators, 1920

isinstanceof, 184

statements

break, 2324

catch, 3536

continue, 2324

if, 20

return, 25

switch, 2021

throw, 36

try, 3536

strings

combining, 31

converting arrays into, 34

manipulating, 2931

replacing words in, 31

searching, 31

splitting, 32

string-related methods, 3031

variables

defining, 1516

passing to functions, 2425

scope, 2627

JavaScript Object Notation. See JSON (JavaScript Object Notation)

join() method, 33, 34

journal option, 242

JSON (JavaScript Object Notation), 73

converting JavaScript objects to, 74

converting to JavaScript objects, 74

file implementation and access, 472475

app.module.ts, 473474

dummyDB.JSON, 472

http.component.CSS, 474475

http.component.html, 474

http.component.ts, 473

responses, sending, 355357

json pipe, 423

jsonp callback name setting (Express), 344

jsonp replacer setting (Express), 344

jsonp spaces setting (Express), 344

K

keepAlive option (server object), 224

key option

htp.createServer(), 135136

https.request(), 135136

tls.connect(), 154

tls.createServer(), 155

(keydown) event, 458

(keypress) event, 458

keys

private keys, generating, 135

shard keys, 336337

x509 public key, 135, 137

(keyup) event, 458

keywords. See also statements

export, 392

import, 392

new, 27

styles, 405

styleUrls, 408

templateUrl, 408

this, 323

var, 1516

keywords directive, 48

kill() method, 161, 165, 176

killSignal property (exec() method), 167

L

$last operator, 286

lastIndexOf() method, 30, 33

leave() method, 527

length of buffers, determining, 78

less than (<) operator, 19

less than or equal to (<=) operator, 19

limit() method, 301, 318

$limit operator, 284

limit option (options object), 264

limiting result sets, 270

by fields, 271272

paging results, 273274

by size, 270271

listDatabases() method, 229, 233

listdb_connect_url.js, 225

listen() method, 124, 146, 345

listeners, 458

adding to objects, 65

implementing, 6567

removing from objects, 65

listeners() function, 65

listening event, 145, 174

listing

collections, 214, 237

databases, 211, 233

files, 108110

MongoDB server status, 236237

MongoDB user accounts, 206207

listings

animated.component.css, 529

animated.Component.html, 529

animated.component.ts, 527528

app.component.css

AreaCalcService, 509

custom directive with component, 454

drag-and-drop application, 535536

RandomImageService, 513514

router with navigation bar, 495

star rating application, 544

app.component.html

animation application, 526527

AreaCalcService, 508509

custom directive with component, 453454

drag-and-drop application, 535

image zoom application, 531

PiService, 506

PromiseService, 516

RandomImageService, 513

router with navigation bar, 494

SharedService, 519

star rating application, 543544

zoom directive, 451452

app.component.ts

animation application, 526

AreaCalcService, 507508

custom directive with component, 453

drag-and-drop application, 534535

image zoom application, 530531

PiService, 505

PromiseService, 515516

RandomImageService, 512513

router with navigation bar, 494

router with parameters, 498

SharedService, 519

simple router application, 490

star rating application, 543

app.module.js, 401

app.module.ts

Angular bootstrapper, 400

animation application, 525526

simple mock server implementation, 473474, 480

simple router implementation, 488489

star rating application, 540

app-routing.module.ts

router with navigation bar, 492493

router with parameters, 498

simple router implementation, 489490

area-calc.service.ts, 506507

attribute.component.css, 448

attribute.component.html, 447

attribute.component.ts, 446447

badguys.component.css, 522

badguys.component.html, 522

badguys.component.ts, 521

basicExpressions.component.ts, 417

buffer_concat.js, 81

buffer_copy.js, 79

buffer_read.js, 78

buffer_slice.js, 80

buffer_write.js, 77

builtInPipes.component.ts, 425

callback_chain.js, 70

callback_closure.js, 69

callback_parameter.js, 6768

censortext.js, 49

character.component.css, 462

character.component.html, 462

character.component.ts, 461462

child_exec.js, 167168

child_fork.js, 172173

child_process_exec_file.js, 168169

child_process_spawn_file.js, 170171

class.component.ts, 434

classExpressions.component.ts, 418419

cluster_server.js, 177179

collection_create_list_delete.js, 238239

collection_stat.js, 239240

constructor.component.ts, 407

container.component.css, 455

container.component.html, 455

container.component.ts, 454

createDelete.component.CSS, 479480

createDelete.component.html, 479

createDelete.component.ts, 477478

customevent.component.html, 459460

customevent.component.ts, 459

customPipes.component.ts, 427

custom.pipe.ts, 427

data.service.ts, 476, 481482

db_connect_object.js, 226

db_create_list_delete.js, 234236

db_status.js, 236237

details.component.css, 463

details.component.html, 463

details.component.ts, 462463

dns_lookup.js, 187188

doc_aggregate.js, 288

doc_count.js, 268269

doc_delete_one.js, 257258

doc_delete.js, 255256

doc_distinct.js, 277

doc_fields.js, 271272

doc_find.js, 247248

doc_group.js, 279280

doc_insert.js, 245246

doc_limit.js, 270271

doc_modify.js, 251

doc_paging.js, 273274

doc_query.js, 266268

doc_save.js, 252253

doc_sort.js, 275276

doc_update.js, 249250

doc_upsert.js, 253254

drag.component.css, 538

drag.component.html, 538

drag.component.ts, 538

drop.component.css, 537

drop.component.html, 537

drop.component.ts, 536

dummyDB.JSON, 472

emitter_listener.js, 6667

encrypt_password.js, 189

event.component.ts, 436438

express_auth_one.js, 376

express_auth_session.js, 378379

express_auth.js, 376

express_cookies.js, 373374

express_http_https.js, 345

express_json.js, 356

express_middleware.js, 381

express_post.js, 372

express_redirect.js, 359

express_request.js, 351

express_routes.js, 349350

express_send_file.js, 358

express_send.js, 354

express_session.js, 374375

express_static.js, 370

express_templates.js, 363364

external.component.ts, 409

external.css, 409

externalTemplate.html, 409

file_read_async.js, 105

file_read_stream.js, 106

file_read_sync.js, 103104

file_readdir.js, 109110

file_read.js, 102103

file_stats.js, 108

file_write_async.js, 100101

file_write_stream.js, 101

file_write_sync.js, 99

file_write.js, 98

first.component.js, 402

first.component.ts, 400

first.html, 399

good-guys.component.css, 521

good-guys.component.html, 520

good-guys.component.ts, 520

home.component.html, 490

home.component.ts, 490

http_client_get.js, 128

http_client_post.js, 131

http_client_static.js, 126127

http_server_external, 132133

http_server_get.js, 128

http_server_post.js, 130

http_server_static.js, 126

http.component.CSS, 474475

http.component.html, 474

http.component.ts, 473

inner.component.ts, 412

input.component.ts, 413414

interpolation.component.ts, 430431

intro.ts, 406

main_pug.pug, 362363

mockbackend.service.ts, 540541

mongoose_aggregate.js, 319

mongoose_connect.js, 293

mongoose_create.js, 308309

mongoose_find.js, 306307

mongoose_middleware.js, 323324

mongoose_remove_many.js, 316

mongoose_remove_one.js, 315

mongoose_save.js, 310

mongoose_update_many.js, 313314

mongoose_update_one.js, 312

mongoose_validation.js, 321

nav.component.CSS, 494

nav.component.html, 493

nav.component.ts, 493

nexttick.js, 6364

observable.component.html, 467

observable.component.ts, 466467

os_info.js, 182183

outer.component.ts, 411

outer.css, 411

outer.html, 411

package.json, 50, 51

page1.component.html, 499

page1.component.ts

router with navigation bar, 495

router with parameters, 499

page2.component.html

router with navigation bar, 496

router with parameters, 500

page2.component.ts

router with navigation bar, 495

router with parameters, 500

page3.component.html, 496

page3.component.ts, 496

person.component.ts, 413

pi.service.ts, 505

process_info.js, 163164

promise.service.ts, 515

property.component.ts, 432

random-image.service.ts, 511512

rated-item.component.css, 545546

rated-item.component.html, 545

rated-item.component.ts, 544545

ratings.service.ts, 541542

readwords.js, 52

route2.component.html, 491

route2.component.ts, 491

shared.service.ts, 517518

simple_interval.js, 6162

simple_timer.js, 6061

socket_client.js, 148149

socket_server.js, 151152

./static/css/static.css, 370

stream_duplex.js, 87

stream_piped.js, 90

stream_read.js, 8384

stream_transform.js, 8889

stream_write.js, 85

structural.component.ts, 443444

style.component.ts, 435

twoWay.component.ts, 439440

typescriptExpressions.component.ts, 421

update.component.CSS, 485486

update.component.html, 484485

update.component.ts, 482483

user_ejs.html, 362

user.service.ts, 478479, 483484

util_inherit.js, 185186

word_schema.js, 297

zlib_buffers.js, 9192

zlib_file.js, 93

zoom.component.ts, 450452

zoom.directive.ts, 450451

zoomit.component.css, 532

zoomit.component.html, 532

zoomit.component.ts, 531532

little endian, 75

load() method, 205, 206

loadavg() method, 182

loadChildren property (route object), 487

local template variables, adding, 361

localAddress property

ClientRequest object, 119

Socket object, 143

localPort property (Socket object), 144

location() method, 353

log() function, 53

logCar() function, 6770

logColorCar() function, 67

logger middleware, 367

logout() method, 228, 229

--logpath parameter (mongod command), 203

lookup() method, 186

$lookup operator, 285

loops, 21

do/while, 22

for, 2223

for/in, 23

interrupting, 2324

while, 21

lowercase pipe, 423

lt() method, 303

$lt operator, 263

$lte operator, 263

M

main directive, 47

main_pug.pug listing, 362363

manipulating

arrays, 3233

strings, 2931

map() method, 471

MapReduce, 282. See also aggregating results

markModified() method, 305

match() method, 30, 318

$match operator, 283, 284

$max operator, 286

max option (collections), 214

maxBuffer property (exec() method), 167

--maxConns parameter (mongod command), 203

maxScan option (options object), 265

maxTickDepth() method, 162

media files, 9

memoryUsage() method, 162

message event, 165, 176

method property

ClientRequest object, 119

IncomingMessage object, 123

Request object, 351

methods. See also individual methods (for example, write() method)

adding to schemas, 295296

definition of, 27

methods property (Schema object), 296

middleware (Express), 367368

assigning globally to path, 368

assigning to single route, 368

basicAuth, 368, 375377

bodyParser, 368, 371372

compress, 368

cookieParser, 368, 373374

cookieSession, 368, 374375

csrf, 368

custom, 380381

favicon, 367

functions, 369

logger, 367

Mongoose middleware functions, 322324

query, 368, 369

session, 368, 377380

static, 367, 369371

middleware functions (Mongoose), 322324

$min operator, 286

mkdir() method, 111

mkdirSync() method, 111

mock back-end service, 540541

mock web servers

simple JSON file implementation, 472475

app.module.ts, 473474

dummyDB.JSON, 472

http.component.CSS, 474475

http.component.html, 474

http.component.ts, 473

simple mock server implementation, 475481

app.module.ts, 480

createDelete.component.CSS, 479480

createDelete.component.html, 479

createDelete.component.ts, 477478

creating, 475

data.service.ts, 476

user.service.ts, 478479

simple mock server updates, 481486

data.service.ts, 481482

update.component.CSS, 485486

update.component.html, 484485

update.component.ts, 482483

user.service.ts, 483484

mockbackend.service.ts listing, 540541

mod() method, 303

$mod operator, 263, 287

model() method, 298

Model object, 292, 298

models, compiling, 298

modifiedFields() method, 310

modifiedPaths() method, 305

modules (Angular), 392

importing

AppRoutingModule, 488

BrowserAnimationsModule, 526

Component, 396397

HttpModule, 473474

InMemoryDbService, 476, 481

InMemoryWebApiModule, 480481

NgModule, 397398

Router, 492

routing module, 488

TypeScript, 387388

modules (Node.js)

assertion testing, 190

buffer. See buffers

C/C++ add-ons, 190

child_process, 159160

child forks, 171173

ChildProcess object, 164166

executable files, executing on another process, 168169

processes, spawning, 169171

system command, executing on another process, 166168

cluster, 174

events, 174

HTTP clusters, 176179

methods, 175

properties, 175

Worker object, 175176

console, 5354

creating, 4950

crypto, 188190

definition of, 43

dns, 186188

events. See events

express. See Express

fs. See file system

global, 190

http. See HTTP (Hypertext Transfer Protocol)

https, 134135

certificate signing request files, 135

HTTPS clients, 135136

HTTPS servers, 137

private keys, 135

installing, 46

loading into Node.js applications, 5253

mongodb. See MongoDB Node.js driver

mongoose. See Mongoose

net, 41. See also socket services

Server object, 144147

Socket objects, 140144

Node Package Manager, 4445

Node Package Registry, 4344

publishing modules to, 5051

viewing, 4344

os, 181183

overview of, 4041

package.json file, 4748

process, 159

process execution, 161

process I/O pipes, 159160

process signals, 160

returning information from, 161164

publishing to NPM Registry, 5051

REPL (Read Event Print Loop), 190

searching for, 45

stream. See streams

tls, 139140, 152153

TLS socket clients, 153154

TLS socket servers, 154156

util, 183186

format() method, 183184

inherits() method, 185186

inspect() method, 184185

isinstanceof operator, 184

V8, 190

Zlib, 91

compressing/decompressing buffers, 9192

compressing/decompressing streams, 9293

modules module, 41

modulus (%) operator, 18

MongoClient object, 222, 223226

mongod command, 202203

MongoDB, 192. See also MongoDB Node.js driver; Node.js-to-Angular stack

access control, 209

authentication, 210211

Database Administrator accounts, 211

User Administrator accounts, 209210

access from shell client, 203204

command parameters, 205

shell commands, 204

shell methods, 205

shell scripts, 205206

advantages of, 3, 1213

atomic write operations, 198

backing up, 341342

collections

accessing statistics for, 239240

adding documents to, 217, 244246, 307309

atomically modifying documents in, 250251

capped collections, 197198, 330

collection_create_list_delete.js application example, 238239

creating, 214215, 237

definition of, 192

deleting, 215216, 238

deleting documents in, 217218, 255256

displaying list of, 214

enabling sharding on, 340

finding documents in, 216, 305307

getting documents from, 246248

listing, 237

number of, 199

removing documents from, 314317

removing single document from, 257258

saving documents in, 252253, 310311

updating documents in, 218219, 248250, 309310

upserting documents in, 253254

connecting to

MongoClient object, 222, 223226

Mongoose, 292294

write concern, 222

data life cycles, 199

data model, planning, 194195

data types, 193194

data usability and performance, 200

databases

changing current, 211212

connecting to using Mongoose, 292294

copying, 213

creating, 212, 234

database change options, 241242

db_create_list_delete.js sample application, 234236

deleting, 212213, 234

displaying list of, 211

listing, 233

repairing, 341

update operators, 242244

definition of, 3, 12

distinct field values, finding, 276277

documents

adding, 217, 244246, 307309

aggregating with Mongoose, 317320

atomically modifying, 250251

counting, 268269

data denormalization, 196197

data normalization, 195196

embedded documents, 196197

finding, 216, 265268, 305307

getting from collections, 246248

growth of, 198

paths, 294

references, 195196

removing, 217218, 255256, 257258, 314317

saving, 252253, 310311

structure of, 192193

TTY (time-to-live), 199

updating, 218219, 248250, 309314

upserting, 253254

downloading, 202

indexing, 198199, 327330

installing, 201202

MapReduce, 282

middleware functions, 322324

Mongoose, 291292

adding documents with, 307309

aggregating documents with, 317320

Document object, 304305

finding documents with, 305307

middleware functions, 322324

models, compiling, 298

objects, 292

Query object, 298305

removing multiple documents with, 315317

removing single documents with, 314315

schemas, 294298

updating multiple documents with, 313314

updating single documents with, 311313

validation framework, 320322

objects

Admin, 229

Collection, 229232

Cursor, 232233

Db, 227228

MongoClient, 222, 223226

options, 264265

query, 262264

replication, 199

applying, 330332

replica sets, 333334

strategy, 332333

result sets, 270

aggregating, 282289

grouping results, 277282

limiting by size, 270271

limiting fields returned in, 271272

paging results, 273274

sorting, 275276

server status, displaying, 236237

sharding, 199

definition of, 334

enabling on collections, 340

enabling on databases, 339340

hash-based sharding, 337

partitioning methods, 337

range-based sharding, 337

shard keys, 336337

shard tag ranges, 340341

sharded MongoDB clusters, 338339

sharding server types, 335

starting, 202203

stopping, 203

user accounts

creating, 206207

listing, 206207

removing, 209

roles, 208

mongodb module. See MongoDB Node.js driver

MongoDB Node.js driver. See also Mongoose

adding to project, 221

collections

accessing statistics for, 239240

collection_create_list_delete.js application example, 238239

creating, 237

deleting, 238

listing, 237

database change options, 241242

database update operators, 242244

databases

creating, 234

db_create_list_delete.js sample application, 234236

deleting, 234

listing, 233

distinct field values, finding, 276277

documents

adding to collections, 244246

atomically modifying, 250251

counting, 268269

deleting, 255258

finding specific sets of, 265268

getting from collections, 246248

saving in collections, 252253

updating in collections, 248250

upserting, 253254

objects

Admin, 229

Collection, 229232

Cursor, 232233

Db, 227228

query objects, 262265

result sets, 270

aggregating, 282289

grouping results, 277282

limiting by size, 270271

limiting fields returned in, 271272

paging results, 273274

sorting, 275276

mongod.exe, 202

mongodump command, 342

Mongoose, 291292

connecting to MongoDB with, 292294

Document object, 304305

documents

adding, 307309

aggregating, 317320

finding, 305307

removing multiple, 315317

removing single, 314315

saving, 310311

updating multiple, 313314

updating single, 311313

models, compiling, 298

objects, 292

Query object, 298299

operators, 302304

query database operation, 299302

schemas

defining, 294295

implementing on database, 295296

indexes, 295296

methods, 295296

paths, 294

required fields, forcing, 296

unique fields, 296

value types, 294298

validation framework, 320322

mongoose_aggregate.js listing, 319

mongoose_connect.js listing, 293

mongoose_create.js listing, 308309

mongoose_find.js listing, 306307

mongoose_middleware.js listing, 323324

mongoose_remove_many.js listing, 316

mongoose_remove_one.js listing, 315

mongoose_save.js listing, 310

mongoose_update_many.js listing, 313314

mongoose_update_one.js listing, 312

mongoose_validation.js listing, 321

(mouseover) event, 458

multi option, 242

multikey indexes, 328

multiple documents

removing with Mongoose, 315317

updating with Mongoose, 313314

multiplication (*) operator, 18

$multiply operator, 287

myCustomEvent, 459

N

(new line) escape code, 29

name directive, 47

naming conventions, 193, 404

nav.component.CSS listing, 494

nav.component.html listing, 493

nav.component.ts listing, 493

navigating routes, 488

navigation bar, router with, 492497

app.component.CSS, 495

app.component.html, 494

app.component.ts, 494

app-routing.module.ts, 492493

nav.component.CSS, 494

nav.component.html, 493

nav.component.ts, 493

page1.component.ts, 495

page2.component.html, 496

page2.component.ts, 495

page3.component.html, 496

page3.component.ts, 496

ne() method, 303

$ne operator, 263

nested components

building with dependency injection, 410412

custom events in, 458460

net module, 41. See also socket services

Server object, 144147

Socket objects

creating, 140141

data flow across, 144

events, 141142

methods, 142143

properties, 143144

networkInterfaces() method, 182

new keyword, 27

new line escape code, 29

new option, 242

newSession event, 156

nextObject() method, 232

nextTick() function, 6364, 161

nexttick.js listing, 6364

ng eject command, 395

ng generate component command, 395

ng generate directive command, 395

ng generate enum command, 395

ng generate guard command, 395

ng generate interface command, 395

ng generate module command, 395

ng generate pipe command, 395

ng generate service command, 395

ng new command, 395

ng serve command, 395

ng-content directive, 452

ngFor directive, 442, 474, 479, 484, 513

ngForm directive, 445

ngIf directive, 442443

ngModel directive, 445

NgModule, 397398, 410

ngOnInit() method, 465, 482, 505, 531, 543

ngStyle directive, 445

ngSwitch directive, 442443

ngSwitchCase directive, 442, 443

ngSwitchDefault directive, 442

nin() method, 303

$nin operator, 263

node file, 42

Node Package Manager. See NPM (Node Package Manager)

Node Package Registry

publishing modules to, 5051

viewing, 4344

Node Packaged Modules. See NPMs (Node Packaged Modules)

node_modules directory, 221

node_modules folder, 42

Node.js. See also modules (Node.js); MongoDB Node.js driver

advantages of, 23, 1112

buffers, 7475

compressing/decompressing, 9192

concatenating, 81

copying, 7980

creating, 7576

determining length of, 78

encoding methods, 75

reading from, 7778

slicing, 80

writing to, 7677

child processes, 164

child forks, 171173

ChildProcess object, 164166

executable files, executing on another process, 168169

processes, spawning, 169171

system command, executing on another process, 166168

companies using, 40

connecting to MongoDB from

MongoClient object, 223226

write concern, 222

definition of, 2, 11, 39

development of, 39

directories

creating, 111112

deleting, 111112

renaming, 112

events, 5556

blocking I/O, 5758

callbacks, 6770

conversation metaphor, 5759

custom events, 6465

event callbacks, 5556

event listeners, 6567

event queue, scheduling work on, 5960

threaded models, 5556

executables, verifying, 4243

files

asynchronous file system calls, 95

deleting, 110

listing, 108110

opening/closing, 9697

reading, 102106

renaming, 112

returning statistics about, 107108

synchronous file system calls, 95

truncating, 110111

verifying path of, 106107

watching for file changes, 112113

writing, 97102

HTTP services, 115

ClientRequest object, 118121

dynamic GET servers, 127129

external sources, interacting with, 132134

IncomingMessage object, 122123

POST servers, 130131

query string and form parameter processing, 117118

Server object, 123125

ServerResponse object, 121122

static files, serving, 125127

URLs (Uniform Resource Locators), 115117

HTTPS services, 134135

certificate signing request files, 135

HTTPS clients, 135136

HTTPS servers, 137

private keys, 135

IDE (Integrated Development Environment), 43

install location, 42

installing, 42

JSON (JavaScript Object Notation), 73

converting JavaScript objects to, 74

converting to JavaScript objects, 74

manipulating documents from. See documents (MongoDB)

MongoClient object, 222

nextTick() function, 6364

objects

checking type of, 184

converting to strings, 184185

EventEmitter, 6465

Stats, 107

process clusters, 174

events, 174

HTTP clusters, 176179

methods, 175

properties, 175

Worker object, 175176

processes, 159

executable files, executing on another process, 168169

process execution, 161

process I/O pipes, 159160

process signals, 160

returning information about, 161164

spawning, 169171

system command, executing on another process, 166168

socket services, 139140

net.Server object, 144147

net.Socket object, 140144

TCP socket clients, 147150

TCP socket servers, 150152

TLS socket clients, 153154

TLS socket servers, 154156

TLS/SSL, 152153

streams, 81

compressing/decompressing, 9293

Duplex streams, 8688

piping, 8990

Readable streams, 8284, 8990

Transform streams, 8889

Writable streams, 8486, 8990

strings

converting objects to, 184185

formatting, 183184

timers, 60

dereferencing, 63

immediate timers, 62

interval timers, 6162

timeout timers, 6061

use cases for, 40

Zlib, 91

compressing/decompressing buffers, 9192

compressing/decompressing streams, 9293

Node.js modules. See modules (Node.js)

Node.js-to-Angular stack, 7

components of, 1114

web development framework

backend services, 10

browsers, 810

diagram of, 78

users, 8

webservers, 10

nodelay option (server object), 224

--nohttpinterface parameter (mongod command), 203

--nojournal parameter (mongod command), 203

--noprealloc parameter (mongod command), 203

nor() method, 303

$nor operator, 263

normalizing data, 195196

NoSQL, 191192. See also MongoDB

not (!) operator, 19

not equal (!=) operator, 19

$not operator, 263

NPM (Node Package Manager), 4445

npm command, 42, 4445

npm adduser, 50

npm install, 46, 51

npm pack, 50

npm search, 45

npm install command, 475

NPMs (Node Packaged Modules). See modules (Node.js)

NPNProtocols option (tls.createServer), 155

null data type

JavaScript, 17

TypeScript, 384

number data type

JavaScript, 16

TypeScript, 383

number of MongoDB collections, 199

number pipe, 423

numberOfRetries option (options object), 265

O

Object Document Model (ODM). See Mongoose

object literals, 17

objects, 27

Admin, 229

Array, 3233

adding items to, 3435

combining, 3334

converting into strings, 34

iterating through, 34

manipulating, 3233

methods, 3233

removing items from, 3435

searching, 34

checking type of, 184

ChildProcess object, 164166

ClientRequest, 118121

Collection. See collections (MongoDB)

Connection, 292293

converting JSON to, 74

converting to JSON, 74

converting to strings, 184185

Cursor, 232233

custom events, 6465

custom-defined objects, 28

Db, 227228

Document, 292, 304305

event listeners

adding, 65

implementing, 6567

removing, 65

EventEmitter, 6465

IncomingMessage, 122123

inheriting from, 185186

Model, 292, 298

MongoClient, 222, 223226

Observable

creating, 464465

detecting data changes with, 465468

importing, 510512

options, 264265, 275276

properties, 27

prototyping object patterns, 29

Query, 262264, 298299

operators, 302304

query database operation, 299302

Request, 350352

Response, 352

download responses, 359

files in, 356358

headers, 352353

JSON responses, 355357

redirection, 359

rendered templates in, 363364

sending, 353355

status, 353

route, 487

Schema, 292, 294295

Server, 123125, 144147

ServerResponse, 121122

Socket

creating, 140141

data flow across, 144

events, 141142

methods, 142143

properties, 143144

Stats, 107

String, 2931

combining, 31

converting arrays into, 34

escape codes, 2930

manipulating, 2931

methods, 3031

replacing words in, 31

searching, 31

splitting, 32

syntax, 2728

URL, 116117

Worker, 175176

Observable object

creating, 464465

detecting data changes with, 465468

importing, 510512

observable.component.html listing, 467

observable.component.ts listing, 466467

observables

definition of, 464

Observable object

creating, 464465

detecting data changes with, 465468

importing, 510512

ODM (Object Document Model). See Mongoose

once() function, 65

onDrop() method, 536

on() function, 65, 126, 160

online event, 174

open() method, 56, 9697, 227

opening files, 9697

openSync() method, 9697

operators

JavaScript, 17

arithmetic operators, 1718

assignment operators, 18

comparison operators, 1920

isinstanceof, 184

MongoDB

$add, 286

$addFields, 285

$addToSet, 243, 286

$all, 264

$and, 263

$avg, 286

$bit, 244

$bucket, 285

$bucketAuto, 285

$collStatus, 284

$concat, 287

$count, 285

$divide, 286

$each, 244

$elemMatch, 264, 266

$eq, 263

$exists, 263

$facet, 285

$first, 286

$geoNear, 285

$graphLookup, 285

$group, 284

$gt, 263

$gte, 263

$inc, 243, 263

$indexStats, 285

$last, 286

$limit, 284

$lookup, 285

$lt, 263

$lte, 263

$match, 283, 284

$max, 286

$min, 286

$mod, 263, 287

$multiply, 287

$ne, 263

$nin, 263

$nor, 263

$not, 263

$or, 263

$out, 285

$pop, 243

$project, 284

$pull, 244

$pullAll, 243

$push, 244, 286

$redact, 284

$regex, 264

$rename, 243

$replaceRoot, 285

$sample, 285

$set, 243

$setOnInsert, 243

$size, 264

$skip, 284

$slice, 244

$sort, 244, 284

$sortByCount, 285

$strcasecmp, 287

$substr, 287

$subtract, 287

$sum, 286

$toLower, 287

$toUpper, 287

$type, 263

$unset, 243

$unwind, 284

options object, 264265, 275276

or() method, 303

or (||) operator, 19

$or operator, 263

originalUrl property (Request object), 351

os module, 41, 181183

os_info.js listing, 182183

$out operator, 285

outer.component.ts listing, 411

outer.css listing, 411

outer.html listing, 411

outlet property (route object), 487

P

package.json file, 4748, 50, 51

packages. See modules (Node.js)

page1.component.html listing, 499

page1.component.ts listing

router with navigation bar, 495

router with parameters, 499

page2.component.html listing

router with navigation bar, 496

router with parameters, 500

page2.component.ts listing

router with navigation bar, 495

router with parameters, 500

page3.component.html listing, 496

page3.component.ts listing, 496

paging results, 273274

param() method, 349

parameters

MongoDB shell commands, 205

passing to callback functions, 6768

route parameters, applying, 347

callback functions, 348349

with defined parameters, 348

express_routes.js example, 349350

with query strings, 347348

with regex, 348

router with parameters, 497501

app.component.ts, 498

app-routing.module.ts, 498

page1.component.html, 499

page1.component.ts, 499

page2.component.html, 500

page2.component.ts, 500

parent components, deleting data in, 461464

parentheses ( ), 20, 24, 436, 457

parse() method, 74, 116, 117118, 347

parseWeather() function, 132

parsing query strings, 117118

partial option (options object), 265

partitioning methods, 337

passing data

with dependency injection, 412413

parameters to functions, 6768

variables to functions, 2425

passphrase option

htp.createServer(), 136

https.request(), 136

tls.connect(), 154

tls.createServer(), 155

patch() method, 470

path module, 41

path property

ClientRequest object, 119

Request object, 351

route object, 487

URL object, 117

pathname property (URL object), 117

paths

assigning Express middleware to, 368

document paths, 294

verifying, 106107

pause() method, 82, 142

pauseOnConnect option, 145

performance, MongoDB, 200

periodic work, scheduling

with immediate timers, 62

with interval timers, 6162

Person interface, 385

person.component.ts listing, 413

PersonInterface, 386

pfx option

htp.createServer(), 136

https.request(), 136

tls.connect(), 154

tls.createServer(), 155

pid method, 162

pid property (ChildProcess object), 166

ping() method, 229

pipe class, 426

@pipe decorator, 426

pipe event, 84

pipe() method, 83, 8990

pipe symbol (|), 426

pipes

built-in pipes

builtInPipes.component.ts, 425

table of, 422424

custom pipes, 426428

definition of, 422

piping Readable streams to Writable streams, 8990

process I/O pipes, 159160

PiService, 505506

app.component.html, 506

app.component.ts, 505

pi.service.ts, 505

pi.service.ts listing, 505

platform() method, 162, 182

playLoop() function, 465

poolSize option (server object), 224

pop() method, 33

$pop operator, 243

--port parameter (mongod command), 202

port property

ClientRequest object, 119

URL object, 116

post() method, 470

post middleware functions, 322324

POST requests

body data, handling, 371372

definition of, 9

POST servers, 130131

pre middleware functions, 322324

preferGlobal directive, 47

preventDefault() method, 536

primary servers, 330

private keys, 135

process module, 41, 159

process execution, 161

process I/O pipes, 159160

process signals, 160

returning information from, 161164

process property (Worker object), 176

process signals, 160

process_info.js listing, 163164

processes, 159

child processes, 159160

ChildProcess object, 164166

executable files, executing on another process, 168169

processes, spawning, 169173

system command, executing on another process, 166168

process clusters, 174

events, 174

HTTP clusters, 176179

methods, 175

properties, 175

Worker object, 175176

process execution, 161

process I/O pipes, 159160

process signals, 160

returning information about, 161164

profile command, 204

project() method, 318

$project operator, 284

PromiseService, 515516

promise.service.ts listing, 515

properties

binding, 431433

ClientRequest object, 119

cluster module, 175

definition of, 27

Document object, 304305

IncomingMessage object, 123

net.Socket object, 143144

Request object, 351

URL object, 116117

Worker object, 176

property binding, 431433

property.component.ts listing, 432

protocol property

Request object, 351

URL object, 116

prototyping object patterns, 29

providers metadata option (NgModule), 397

publishing modules, 5051

$pull operator, 244

$pullAll operator, 243

push() method, 33

$push operator, 244, 286

put() method, 470

PUT requests

response callback functions, 471

sending, 470471

Q

queries

MongoDB query object, 262264

Mongoose Query object, 298299

operators, 302304

query database operation, 299302

options objects, 264265

query strings, 41

applying route parameters with, 347348

processing, 117118

result sets, 270

aggregating, 282289

grouping results, 277282

limiting by size, 270271

limiting fields returned in, 271272

paging results, 273274

sorting, 275276

query middleware, 368, 369

query object (MongoDB), 262264

Query object (Mongoose), 298299

operators, 302304

query database operation

options, 301302

setting, 299302

query property

Request object, 351

URL object, 117

query router servers, 335, 338339

query strings, 41

applying route parameters with, 347348

processing, 117118

queryRemover() function, 380

--quiet parameter (mongod command), 202

R

(carriage return) escape code, 29

RandomImageService, 510514

app.component.css, 513514

app.component.html, 513

app.component.ts, 512513

random-image.service.ts, 511512

random-image.service.ts listing, 511512

range-based sharding, 337

rated-item component, 543544

rated-item.component.css, 545546

rated-item.component.html, 545

rated-item.component.ts, 544545

RatedItem interface, 541

ratings.service.ts listing, 541542

Read Event Print Loop (REPL) module, 41, 190

read() method, 82, 104105, 302, 318

read option (Schema object), 295

read role (MongoDB), 208

readable event, 82

Readable streams, 8284, 8990

readAnyDatabase role (MongoDB), 208

readConcern option (server object), 224

readdir() method, 109

readdirSync() method, 109

readFile() method, 102103

reading files

asynchronous file reading, 104105

simple file read, 102103

streamed file reading, 105106

synchronous file reading, 103104

readInt8() method, 77

readInt16BE() method, 77

readInt16LE() method, 77

readline module, 41

readPreference option

options object, 265

server object, 224

readSync() method, 103104

readwords.js listing, 52

readWrite role (MongoDB), 208

readWriteAnyDatabase role (MongoDB), 208

receiving cookies, 373374

ReconnectInterval option (server object), 224

reconnectTries option (server object), 224

$redact operator, 284

redirect() method, 359

redirecting responses, 359

redirectTo property (route object), 487

ref() method, 63, 143, 146

references, MongoDB documents, 195196

regenerate() method, 378

regex, applying route parameters with, 348

regex() method, 303

$regex operator, 264

Registry, Node Package Registry

publishing modules to, 5051

viewing, 4344

rejectUnauthorized option

htp.createServer(), 136

https.request(), 136

tls.connect(), 154

tls.createServer(), 155

release() method, 182

remoteAddress property (Socket object), 143

remoteFamily property (Socket object), 143

remotePort property (Socket object), 143

remove() method, 217, 230, 255, 301, 305, 314316

removeHeader() method, 122

removeListener() function, 65

removeShardTag() method, 341

removeUser() method, 209, 228, 229

removing data. See deleting data

rename() method, 112, 230

$rename operator, 243

renameCollection() method, 228

renameSync() method, 112

renaming files/directories, 112

render() method, 363364

rendered templates, sending, 363364

rendering browser view, 910

--repair parameter (mongod command), 203

repairDatabase() method, 341

repairing databases, 341

REPL (Read Event Print Loop) module, 41, 190

replace() method, 30, 31

$replaceRoot operator, 285

replacing words in strings, 31

replica sets, deploying, 333334

replication

applying, 330332

replica sets, 333334

strategy, 332333

replications, 199

repository directive, 48

request event, 124

request() method, 118, 136

Request objects, 350352

requestCert option (tls.createServer), 155

requests, 9

ClientRequest object, 118121

configuration, 471

GET requests, 470471

GetData, 5556

GetFile, 5556

POST, 371372

PUT requests, 470471

request event, 124

Request objects, 350352

response callback functions, 471

require() method, 52

required fields, forcing, 296

requiredPaths() method, 296

resolve() method, 117, 186, 515

Resolve property (route object), 487

resolve4() method, 187

resolve6() method, 187

resolveCname() method, 187

resolveMx() method, 187

resolveNs() method, 187

resolveSrv() method, 187

resolveTxt() method, 187

resolving URLs (Uniform Resource Locators), 117

response callback functions (HTTP), 471

response event, 120

Response objects, 352

download responses, 359

headers, 352353

JSON responses, 355357

redirection, 359

sending, 353355

sending files in, 356358

sending rendered templates in, 363364

status, 353

responses

IncomingMessage object, 122123

response event, 120

Response objects, 352

download responses, 359

headers, 352353

JSON responses, 355357

redirection, 359

sending, 353355

sending files in, 356358

sending rendered templates in, 363364

status, 353

ServerResponse object, 121122

responsibilities, separation of, 393

result sets, 270

aggregating, 282289

aggregate() method, 283

aggregation examples, 287289

aggregation expression operators, 285287

aggregation framework operators, 283285

grouping results, 277282

limiting by size, 270271

limiting fields returned in, 271272

paging results, 273274

sorting, 275276

resume() method, 82, 142

resumeSession event, 156

return statement, 25

return values, 25

reusable code, 14, 361

reverse() method, 33, 187

rewind() method, 233

rmdir() method, 111

rmdirSync() method, 111

roles (MongoDB), 208

roles command, 204

root component (custom directive), 453

CSS for, 454

HTML for, 453454

route object, 487

route2.component.html listing, 491

route2.component.ts listing, 491

Router, importing, 488

Router module, importing, 492

router service, 470

ActivatedRoute, importing, 488

route navigation, 488

route object parameters, 487

Router, importing, 488

router with navigation bar, 492497

app.component.CSS, 495

app.component.html, 494

app.component.ts, 494

app-routing.module.ts, 492493

nav.component.CSS, 494

nav.component.html, 493

nav.component.ts, 493

page1.component.ts, 495

page2.component.html, 496

page2.component.ts, 495

page3.component.html, 496

page3.component.ts, 496

router with parameters, 497501

app.component.ts, 498

app-routing.module.ts, 498

page1.component.html, 499

page1.component.ts, 499

page2.component.html, 500

page2.component.ts, 500

Routes array, defining, 486487

routing module, including, 488

simple router implementation, 488491

app.component.ts, 490

app.module.ts, 488489

app-routing.module.ts, 489490

home.component.html, 490

home.component.ts, 490

route2.component.html, 491

route2.component.ts, 491

router-outlet tag, 488

routes

applying parameters in, 347

callback functions, 348349

with defined parameters, 348

express_routes.js example, 349350

with query strings, 347348

with regex, 348

assigning Express middleware to, 368

definition of, 345

implementing, 346

Routes array, defining, 486487

routing module, including, 488

runGaurdsAndResolvers property (route object), 487

S

safe() method, 302

safe option (Schema object), 295

$sample operator, 285

save() method, 217, 218219, 230, 252253, 305, 308, 310, 378

saving documents, 252253, 310311

scalability

of MongoDB, 3, 13

of Node.js, 3, 12

scheduling work

nextTick() function, 6364

timers, 60

dereferencing, 63

immediate timers, 62

interval timers, 6162

timeout timers, 6061

Schema object, 292, 294295

schema property (Document object), 305

schemas

defining, 294295

implementing on database, 295296

indexes, adding, 295296

methods, adding, 295296

paths, 294

required fields, forcing, 296

Schema object, 292, 294295

unique fields, 296

value types, 294298

schemas metadata option (NgModule), 397

scope of variables, 2627

scripts, 205206. See also listings

scripts directive, 47

search() method, 30

search property (URL object), 117

searching

arrays, 34

collections, 216

documents, 216, 265268

field values, 276277

for NPMs (Node Packaged Modules), 45

strings, 31

secondary servers, 331

SecretAgent class, 387

secure property (Request object), 351

secureConnection event, 156

secureProtocol option

htp.createServer(), 136

https.request(), 136

tls.connect(), 154

tls.createServer(), 155

select() method, 301

selectCharacter() function, 461

selector option (components), 403

selectors, 404

selectUser() method, 482

send() method, 165, 176, 353355

sendData event, 121

sendfile() method, 356358

sending

cookies, 373374

rendered templates, 363364

requests, 470471

responses

download responses, 359

JSON responses, 355357

redirection, 359

send() method, 353355

separation of responsibilities, 393

serializeFunctions option, 242

Server object, 123125, 144147

server status, displaying, 236237

servername option (tls.connect), 154

ServerResponse object, 121122

servers. See also mock web servers

arbiter, 331

config servers, 335, 338

Express server, starting, 345

HTTP (Hypertext Transfer Protocol)

dynamic GET servers, 127129

external sources, interacting with, 132134

POST servers, 130131

Server object, 123125

static files, serving, 125127

HTTPS, 137

MongoDB server status, displaying, 236237

primary servers, 330

query router servers, 335, 338339

secondary servers, 331

shard servers, 335

TCP socket servers, 150152

TLS socket servers, 154156

server-side programs, 10

serverStatus() method, 229

services (Angular)

animate, 470

animation service, application using

animated.component.css, 529

animated.component.html, 529

animated.component.ts, 527528

app.component.html, 526527

app.component.ts, 526

app.module.ts, 525526

folder structure, 525

constant data service, 505506

app.component.html, 506

app.component.ts, 505

pi.service.ts, 505

data transform service, 506510

app.component.css, 509

app.component.html, 508509

app.component.ts, 507508

area-calc.service.ts, 506507

definition of, 393

forms, 470

http, 470

GET requests, sending, 470471

JSON file implementation and access, 472475

PUT requests, sending, 470471

request configuration, 471

response callback functions, 471

simple mock server implementation, 475481

simple mock server updates, 481486

integrating into applications, 503504

mock back-end service, 540541

purpose of, 469

ratings service, 541542

router, 470

ActivatedRoute, importing, 488

route navigation, 488

route object parameters, 487

Router, importing, 488

router with navigation bar, 492497

router with parameters, 497501

Routes array, 486487

routing module, including, 488

simple router implementation, 488491

service that returns a promise, 515516

shared service, 516523

app.component.html, 519

app.component.ts, 519

badguys.component.css, 522

badguys.component.html, 522

badguys.component.ts, 521

good-guys.component.css, 521

good-guys.component.html, 520

good-guys.component.ts, 520

shared.service.ts, 517518

use cases for, 503504

UserService, 483484

variable data service, 510514

app.component.css, 513514

app.component.html, 513

app.component.ts, 512513

random-image.service.ts, 511512

session middleware, 368, 377380

sessionIdContext option (tls.createServer), 155

sessions

implementing, 374375

session authentication, 377380

session middleware, 368

set() method, 304, 344, 352

$set operator, 243

setEncoding() method, 82, 142

setgid() method, 162

setgroups() method, 163

setHeader() method, 122

setImmediate() function, 62

setInterval() function, 6162

setKeepAlive() method, 143

setMaxListeners() function, 65

setNoDelay() method, 121, 143

$setOnInsert operator, 243

setOptions() method, 301

setRating() method, 544

sets of documents, finding, 265268

setSocketKeepAlive() method, 121

setTimeout() function, 6061, 120, 122, 123, 143, 510

settings property (cluster module), 175

setuid() method, 162

setup event, 174

setupMaster() method, 175

shard keys, 336337

shard tag ranges, 340341

sharding, 199

definition of, 334

enabling on collections, 340

enabling on databases, 339340

hash-based sharding, 337

partitioning methods, 337

range-based sharding, 337

shard keys, 336337

shard tag ranges, 340341

sharded MongoDB clusters, 338

adding shards to cluster, 339

config server database instances, 338

query router servers, 338339

sharding server types, 335

shared service, 516523

app.component.html, 519

app.component.ts, 519

badguys.component.css, 522

badguys.component.html, 522

badguys.component.ts, 521

good-guys.component.css, 521

good-guys.component.html, 520

good-guys.component.ts, 520

shared.service.ts, 517518

SharedService. See shared service

shared.service.ts listing, 517518

shell clients, accessing MongoDB from, 203204

command parameters, 205

shell commands, 204

shell methods, 205

shell scripts, 205206

shift() method, 33

show command, 204

SIGBREAK event, 160

SIGHUP event, 160

SIGINT event, 160

SIGKILL event, 160

sign class, 189

signals, process, 160

SIGPIPE event, 160

SIGSTOP event, 160

SIGTERM event, 160

SIGUSR1 event, 160

SIGWINCH event, 160

silent property (fork() function), 172

simple_interval.js listing, 6162

simple_timer.js listing, 6061

single documents

removing with Mongoose, 314315

updating with Mongoose, 311313

single field indexes, 328

size, limiting results by, 270271

size() method, 304

$size operator, 264

size option (collections), 214

skip() method, 302, 318

$skip operator, 284

skip option (options object), 264

slice() method, 30, 33, 80

$slice operator, 244

slice:start:end pipe, 423

slicing buffers, 80

snapshot() method, 302

snapshot option (options object), 265

SNICallback option (tls.createServer), 155

socket event, 120

Socket objects

creating, 140141

data flow across, 144

events, 141142

methods, 142143

properties, 143144

socket property (IncomingMessage object), 123

socket services, 139140

net.Server object, 144147

net.Socket object

creating, 140141

data flow across, 144

events, 141142

methods, 142143

properties, 143144

TCP socket clients, 147150

TCP socket servers, 150152

TLS socket clients, 153154

TLS socket servers, 154156

socket_client.js listing, 148149

socket_server.js listing, 151152

socketPath property (ClientRequest object), 119

socketTimeOut option (server object), 224

soldierOfGondor() function, 388

sort() method, 33, 233, 302, 318

$sort operator, 244, 284

sort option (options object), 264, 275276

$sortByCount operator, 285

sorting result sets, 275276

spare property (indexes), 329

spawn() method, 169171

spawning processes, 169171

splice() method, 33

split() method, 30, 32

splitting strings, 32

SQL injection, 13

ssl option (server object), 224

stale property (Request object), 351

star rating application

app.component.css, 544

app.component.html, 543544

app.component.ts, 543

app.module.ts, 540

folder structure, 539

mockbackend.service.ts, 540541

rated-item.component.css, 545546

rated-item.component.html, 545

rated-item.component.ts, 544545

ratings.service.ts, 541542

starting

Express server, 345

MongoDB, 202203

query router servers, 338339

statements. See also keywords

break, 2324

catch, 3536

continue, 2324

finally, 3637

if, 20

return, 25

switch, 2021

throw, 36

try, 3536

static files, serving, 125127, 369371

static middleware, 367, 369371

./static/css/static.css listing, 370

statistics, accessing

collection statistics, 239240

file statistics, 107108

stats() method, 107108, 232

Stats object, 107

statsSync() method, 107

status of Response objects, 353

statusCode event, 121, 123

stderr, 159, 166

stdin, 159, 166

stdio property (spawn() function), 170

stdout, 159, 166

stopping MongoDB, 203

strategy, replication, 332333

$strcasecmp operator, 287

stream module. See streams

stream_duplex.js listing, 87

stream_piped.js listing, 90

stream_read.js listing, 8384

stream_transform.js listing, 8889

stream_write.js listing, 85

streams, 81

compressing/decompressing, 9293

Duplex streams, 8688

piping, 8990

Readable streams, 8284, 8990

streamed file reading, 105106

streamed file writing, 101102

Transform streams, 8889

Writable streams, 8486, 8990

strict option (Schema object), 295

strict routing setting (Express), 344

string decoder module, 41

String object, 2931

combining, 31

converting arrays into, 34

escape codes, 2930

manipulating, 2931

methods, 3031

replacing words in, 31

searching, 31

splitting, 32

stringify() method, 74, 118

strings, 16

converting objects to, 184185

formatting, 183184

JavaScript

combining, 31

converting arrays into, 34

escape codes, 2930

manipulating, 2931

methods, 3031

replacing words in, 31

searching, 31

splitting, 32

query strings, 41

applying route parameters with, 347348

processing, 117118

TypeScript, 383

Stringy interface, 385

structural directives, 392, 442445

definition of, 441

ngFor, 442

ngIf, 442443

ngSwitch, 442443

ngSwitchCase, 442, 443

ngSwitchDefault, 442

structural.component.ts, 443444

structural.component.ts listing, 443444

style binding, 435436

style.component.ts listing, 435

styles keyword, 405

styles option (components), 404

stylesUrls option (components), 404

styleUrls keyword, 408

(submit) event, 457

subscribe() method, 464

substr() method, 31

$substr operator, 287

substrings, searching for, 31

$subtract operator, 287

subtraction (-) operator, 18

suicide property (Worker object), 176

$sum operator, 286

switch statements, 2021

synchronous file reading, 103104

synchronous file system calls, 95

synchronous file writing, 9899

system command, executing on another process, 166168

T

(tab) escape code, 30

tab escape code, 30

tags, router-outlet, 488

TCP (Transmission Control Protocol)

socket clients, 147150

socket servers, 150152

template engines, 360

defining, 360361

locals, adding, 361

rendered templates, sending, 363364

template creation, 361363

template option (components), 404

templates

building, 404405

creating, 361363

external templates, 408410

template engines, 360

defining, 360361

locals, adding, 361

rendered templates, sending, 363364

template creation, 361363

templateUrl keyword, 408

templateUrl option (components), 404

text indexes, 328

then() method, 472473

this keyword, 323

threaded event models, 5556

throw statement, 36

throwing errors, 36

tilde (~), 404405

time() function, 53

timeEnd() function, 54

timeout event, 141

timeout property

exec() method, 167

options object, 265

timeout timers, 6061

timers, 41, 60

dereferencing, 63

immediate timers, 62

interval timers, 6162

timeout timers, 6061

time-to-live (TTY) values

documents, 199

indexes, 329

title method, 162

tls module, 41, 139140, 152153. See also socket services

TLS socket clients, 153154

TLS socket servers, 154156

tmpdir() method, 181

toArray() method, 232

toJSON() method, 305

$toLower operator, 287

toLowerCase() method, 31

toObject() method, 305

toPromise() method, 471, 472473

toString() method, 33, 77, 305

totalmem() method, 182

touch() method, 378

$toUpper operator, 287

toUpperCase() method, 31

trace() function, 54

trailers property (IncomingMessage object), 123

transform() method, 88

Transform streams, 8889

Transmission Control Protocol. See TCP (Transmission Control Protocol)

truncate() method, 110111

truncateSync() method, 110111

truncating files, 110111

trust proxy setting (Express), 344

try statement, 3536

TTY (time-to-live) values

documents, 199

indexes, 329

two-way binding, 439440

twoWay.component.ts listing, 439440

type() method, 181, 353

$type operator, 263

types. See data types

TypeScript, 383. See also listings

in Angular expressions, 419422

classes

defining, 386

inheritance, 387

data types, 383384

directives, 462463

functions, 388389

interfaces, 385386

modules, 387388

typescriptExpressions.component.ts listing, 421

U

ucs2 encoding, 75

uid property (spawn() function), 170

Uniform Resource Locators. See URLs (Uniform Resource Locators)

unique fields, 296

unique property (indexes), 329

unlink() method, 110

unlinkSync() method, 110

unpipe event, 85

unpipe() method, 83, 8990

unref() method, 63, 143, 146

$unset operator, 243

unshift() method, 33

unwind() method, 318

$unwind operator, 284

update() method, 218219, 231, 248250, 301, 304, 311, 313

update operators, 242244

update.component.CSS listing, 485486

update.component.html listing, 484485

update.component.ts listing, 482483

updateRating() method, 541542

updateUser() method, 482, 483

updating

documents

findAndRemove() method, 218219

with Mongoose, 309314

update() method, 248250

mock web server items, 481486

data.service.ts, 481482

update.component.CSS, 485486

update.component.html, 484485

update.component.ts, 482483

user.service.ts, 483484

upgrade event, 120, 124

uppercase pipe, 423

upsert option, 242

upserting documents, 253254

uptime() method, 162, 182

URL object, 116117

url property (IncomingMessage object), 123

URLs (Uniform Resource Locators), 41

resolving, 117

structure of, 115116

URL object, 116117

use command, 204

use() method, 368

user accounts (MongoDB)

creating, 206207

listing, 206207

removing, 209

roles, 208

User Administrator accounts, 209210

user_ejs.html listing, 362

userAdmin role (MongoDB), 208

userAdminAnyDatabase role (MongoDB), 208

users, 8, 10

users command, 204

UserService, 483484

user.service.ts listing, 478479, 483484

utf8 encoding, 75

utf16le encoding, 75

util module, 183

format() method, 183184

inherits() method, 185186

inspect() method, 184185

isinstanceof operator, 184

util_inherit.js listing, 185186

utilities module, 41

UUID() method, 205

V

V8 module, 41, 190

validate() method, 305, 320

validation framework (Mongoose), 320322

validationAction option (collections), 215

validationLevel option (collections), 215

validator option (collections), 214

valueOf() method, 31, 33

var keyword, 1516

variable data service, 510514

app.component.css, 513514

app.component.html, 513

app.component.ts, 512513

random-image.service.ts, 511512

variables

defining, 1516

local template variables, 361

passing to functions, 2425

scope, 2627

--verbose parameter (mongod command), 202

verify class, 189

verifying

file path, 106107

Node.js executables, 4243

version directive, 47

version method, 161

--version parameter (mongod command), 202

versions method, 161

view cache setting (Express), 344

view engine setting (Express), 344

viewProviders option (components), 404

views (browser), rendering, 910

views setting (Express), 344

Visual Studio Code, 394

VM module, 41

void data type, 384

W

w option, 224, 241

warn() function, 53

watchFile() method, 112113

watching for file changes, 112113

web applications. See components (Angular); services (Angular)

web browsers. See browsers

web development framework

backend services, 10

browsers, 8

browser view, rendering, 910

browser-to-webserver communication, 89

user interaction, 10

diagram of, 78

users, 8

webservers, 10

web servers. See mock web servers

webservers, 10

where() method, 302

while loops, 21

word_schema.js listing, 297

words, replacing in strings, 31

work, scheduling

adding to event queue, 5960

nextTick() function, 6364

timers, 60

dereferencing, 63

immediate timers, 62

interval timers, 6162

timeout timers, 6061

Worker object, 175176

worker property (cluster module), 175

workers property (cluster module), 175

Writable streams, 8486, 8990

write concern, 222

write() method, 76, 8485, 118, 120, 122, 128, 142, 151

write operations, 198

writeContinue() method, 122

writeFile() method, 98

writeInt8() method, 76

writeInt16BE() method, 76

writeInt16LE() method, 76

writeSync() method, 98101

writing

to console, 5354

files

asynchronous file writing, 99101

simple file write, 98

streaming file writing, 101102

synchronous file writing, 9899

wtimeout option, 241

wTimeOut option (server object), 224

X-Y-Z

x509 public key, 135, 137

Zlib module, 41, 91

compressing/decompressing buffers, 9192

compressing/decompressing streams, 9293

zlib_buffers.js listing, 9192

zlib_file.js listing, 93

zoom application

app.component.html, 531

app.component.ts, 530531

folder structure, 530

zoomit.component.css, 532

zoomit.component.html, 532

zoomit.component.ts, 531532

zoom directive, 449452

ZoomDirective export class, 451

zoom.directive.ts listing, 450451

zoomit component

zoomit.component.css, 532

zoomit.component.html, 532

zoomit.component.ts, 531532

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

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