+ (addition) operator, 17
&& (and) operator, 19
= assignment operator, 18
+= assignment operator, 18
-= assignment operator, 18
/= assignment operator, 18
*= assignment operator, 18
%= assignment operator, 18
{ } (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
acceptsCharset property (Request object), 351
accessing MongoDB
access control, 209
Database Administrator accounts, 211
User Administrator accounts, 209–210
command parameters, 205
shell commands, 204
shell methods, 205
accounts (MongoDB)
Database Administrator accounts, 211
user accounts
removing, 209
roles, 208
User Administrator accounts, 209–210
ActivatedRoute, importing, 488
$add operator, 286
addCensoredWords() function, 52
addClass() method, 446
$addFields operator, 285
addition (+) operator, 17
addListener() function, 65
AddNums interface, 385
addShard() method, 339
addShardTag() method, 340
addTagRange() method, 340
addTrailers() method, 122
Admin object, 229
aggregate() method, 283, 301, 317
aggregate() method, 283
aggregation expression operators, 285–287
aggregation framework operators, 283–285
aggregation expression operators, 285–287
aggregation framework operators, 283–285
AJAX (Asynchronous JavaScript and XML) requests, 9
alerts, asynchronous, 516
$all operator, 264
allowDrop() method, 536
and() method, 303
and (&&) operator, 19
$and operator, 263
Angular. See also Node.js-to-Angular stack
adding to environment, 393–394
applications, creating, 395–396, 398–402
animation application, 525–529
component modules, importing, 396–397
drag-and-drop application, 533–539
star rating application, 539–546
app.module.js, 401
app.module.ts, 400
first.component.js, 402
first.component.ts, 400
first.html listing, 399
attribute directives, 392, 445–448
components directives, 392, 442
structural directives, 392, 442–445
CLI (command-line interface), 394–395
Angular bootstrapper components, 398–402
animation application components, 526–529
collections, 204
constructors, 407
custom component directives, 452–456
dependency injection, 392–393, 410–414
drag-and-drop application components, 534–538
emitting custom events from, 458
image zoom application components, 530–532
inline CSS and HTML in, 405–406
integrating custom services into, 503–504
selectors, 404
separation of responsibilities, 393
star rating application components, 539–546
custom directives, 449
custom attribute directives, 449–452
custom component directives, 452–456
custom events, 458
emitting from components, 458
handling with listeners, 458
implementing in nested components, 458–460
data binding, 429
attribute binding, 433
definition of, 392
definition of, 4
Component class interaction, 418–419
pipe implementation, 422
modules, 392
observables
definition of, 464
detecting data changes with, 465–468
separation of responsibilities, 393
services
animate, 470
animation service, application using, 525–529
constant data service, 505–506
definition of, 393
forms, 470
integrating into applications, 503–504
mock back-end service, 540–541
purpose of, 469
service that returns a promise, 515–516
variable data service, 510–514
TypeScript, 383
in Angular expressions, 419–422
classes, 386
inheritance, 387
Angular QuickStart website, 394
animate service, 470
animated component
animated.component.css, 529
animated.component.html, 529
animated.component.ts, 527–528
animation application
animated.component.css, 529
animated.component.html, 529
animated.component.ts, 527–528
app.component.ts, 526
folder structure, 525
any data type, 384
app.component.css listing
AreaCalcService, 509
custom directive with component, 454
drag-and-drop application, 535–536
router with navigation bar, 495
star rating application, 544
app.component.html listing
animation application, 526–527
custom directive with component, 453–454
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, 543–544
animation application, 526
custom directive with component, 453
drag-and-drop application, 534–535
image zoom application, 530–531
PiService, 505
router with navigation bar, 494
router with parameters, 498
SharedService, 519
simple router application, 490
star rating application, 543
append() method, 318
applications (Angular), 395–396, 398–402. 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, 527–528
app.component.ts, 526
folder structure, 525
component modules, importing, 396–397
drag-and-drop application
app.component.html, 535
drag.component.css, 538
drag.component.html, 538
drag.component.ts, 538
drop.component.css, 537
drop.component.html, 537
drop.component.ts, 536
star rating application
app.component.css, 544
app.component.ts, 543
app.module.ts, 540
folder structure, 539
mockbackend.service.ts, 540–541
rated-item.component.css, 545–546
rated-item.component.html, 545
rated-item.component.ts, 544–545
zoom application
app.component.html, 531
folder structure, 530
zoomit.component.css, 532
zoomit.component.html, 532
applications (Node.js), censorify module
censortext.js, 49
loading into Node.js applications, 52–53
publishing to NPM Registry, 50–51
readwords.js, 52
app.module.js listing, 401
app.module.ts listing
Angular bootstrapper, 400
animation application, 525–526
simple mock server implementation, 473–474, 480
simple router implementation, 488–489
star rating application, 540
AppRoutingModule, importing, 488
app-routing.module.ts listing
router with navigation bar, 492–493
router with parameters, 498
simple router implementation, 489–490
arbiter servers, 331
app.component.css, 509
area-calc.service.ts listing, 506–507
argv method, 162
converting into strings, 34
iterating through, 34
searching, 34
arrays, 16
JavaScript
converting into strings, 34
iterating through, 34
searching, 34
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, 104–105
asynchronous file system calls, 95
asynchronous file writing, 99–101
Asynchronous JavaScript and XML (AJAX), 9
atomic write operations, 198
atomically modifying documents, 250–251
attachment() method, 353
attribute binding, 433
attribute directives, 392, 445–448
attribute.component.css, 448
attribute.component.html, 447
attribute.component.ts, 446–447
custom attribute directives, 449–452
definition of, 441
ngForm, 445
ngModel, 445
ngStyle, 445
attribute.component.css listing, 448
attribute.component.html listing, 447
attribute.component.ts listing, 446–447
--auth parameter (mongod command), 203
auth property (URL object), 116
authenticate() method, 228, 229
author directive, 47
auto_reconnect option (server object), 224
autoIndex option (Schema object), 295
autoIndexID option (collections), 214
$avg operator, 286
(backspace) escape code, 30
backend services, 10
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, 375–377
basicExpressions.component.ts listing, 417
big endian, 75
bin directives, 47
--bind parameter (mongod command), 203
binding. See data binding
$bit operator, 244
bodyParser middleware, 368, 371–372
Boolean data type
JavaScript, 16
TypeScript, 383
bootstrap metadata option (NgModule), 397
bootstrapper (Angular), 398–402
app.module.js, 401
app.module.ts, 400
first.component.js, 402
first.component.ts, 400
first.html listing, 399
border() function, 450
BrowserAnimationsModule, loading, 526
browsers, 8
browser-to-webserver communication, 8–9
user interaction, 10
browser-to-webserver communication, 8–9
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
compressing/decompressing, 91–92
concatenating, 81
determining length of, 78
encoding methods, 75
slicing, 80
bufferSize property (Socket object), 143
attribute directives, 392, 445–448
attribute.component.css, 448
attribute.component.html, 447
attribute.component.ts, 446–447
definition of, 441
ngForm, 445
ngModel, 445
ngStyle, 445
components directives, 392, 441, 442
structural directives, 392, 442–445
definition of, 441
ngFor, 442, 474, 479, 484, 513
ngSwitchDefault, 442
structural.component.ts, 443–444
built-in pipes
builtInPipes.component.ts, 425
built-in services
animate, 470
forms, 470
http, 470
GET requests, sending, 470–471
JSON file implementation and access, 472–475
PUT requests, sending, 470–471
request configuration, 471
response callback functions, 471
simple mock server implementation, 475–481
simple mock server updates, 481–486
router, 470
ActivatedRoute, importing, 488
route navigation, 488
route object parameters, 487
Router, importing, 488
router with navigation bar, 492–497
router with parameters, 497–501
routing module, including, 488
simple router implementation, 488–491
builtInPipes.component.ts listing, 425
byteLength() method, 78
bytesRead property (Socket object), 144
bytesWritten property (Socket object), 144
ca option
htp.createServer(), 136
https.request(), 136
tls.connect(), 154
tls.createServer(), 155
callback functions, 67
applying for defined parameters, 348–349
chaining, 70
implementing closure in, 68–69
callback_chain.js listing, 70
callback_closure.js listing, 69
callback_parameter.js listing, 67–68
canActivate property (route object), 487
canActivateChild property (route object), 487
canDeactivate property (route object), 487
canLoad property (route object), 487
capped collections, 197–198, 330
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
censor() function, 52
censorify module
censortext.js, 49
loading into Node.js applications, 52–53
publishing to NPM Registry, 50–51
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) event, 457
changeLoop() method, 510
changeSize() function, 450
character.component.css listing, 462
character.component.html listing, 462
character.component.ts listing, 461–462
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, 461–464
executable files, executing on another process, 168–169
system command, executing on another process, 166–168
child_exec.js listing, 167–168
child_fork.js listing, 172–173
child_process module, 40, 159–160
executable files, executing on another process, 168–169
system command, executing on another process, 166–168
child_process_exec_file.js listing, 168–169
child_process_spawn_file.js listing, 170–171
Children property (route object), 487
cipher class, 188
ciphers option
htp.createServer(), 136
https.request(), 136
tls.createServer(), 155
class.component.ts listing, 434
classes. See also services (Angular)
certificate, 188
cipher, 188
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, 418–419
clearCookie() method, 373
clearImmediate() function, 62
clearInterval() function, 61
clearTimeout() function, 60
CLI (command-line interface), 394–395. See also commands
(click) event, 457
clients
client-side scripts, 9
close event, 82, 121, 123, 124, 142, 145, 165
close() method, 97, 125, 146, 227, 233
closeSync() method, 97
closure in callback functions, 68–69
events, 174
methods, 175
properties, 175
cluster_server.js listing, 177–179
clusterAdmin role (MongoDB), 208
clusters
events, 174
methods, 175
properties, 175
sharded MongoDB clusters, 338
adding shards to cluster, 339
config server database instances, 338
code listings. See listings
Collection object, 229–232. See also collections (MongoDB)
collection option (Schema object), 295
collection_create_list_delete.js listing, 238–239
collection_stat.js listing, 239–240
collectionInfo() method, 227
collectionNames() method, 227
capped collections, 197–198, 330
collection_create_list_delete.js application example, 238–239
definition of, 192
displaying list of, 214
documents
aggregating with Mongoose, 317–320
finding, 216, 265–268, 305–307
removing, 217–218, 255–258, 314–317
updating, 218–219, 248–250, 309–314
listing, 237
number of, 199
sharding on, 340
collections command, 204
collections() method, 228, 237
$collStatus operator, 284
combining
strings, 31
command-line interface, 394–395. See also commands
command-line options module, 40
commands. See also directives
databases, 204
db.help, 204
dbs, 204
executing in another process, 166–168
exit, 204
help, 204
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 adduser, 50
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, 8–9
compatibility of Angular, 14
compiling models, 298
component directives, 441
component property (route object), 487
components (Angular), 396–397, 539–546. See also services (Angular)
animation application, 526–527
animated.component.css, 529
animated.Component.html, 529
animated.component.ts, 527–528
app.component.ts, 526
folder structure, 525
collections, 204
constructors, 407
custom component directives, 452–456
container component, 454
CSS for container component, 455
CSS for root component, 454
HTML for container component, 455
HTML for root component, 453–454
root component, 453
dependency injection
building nested components with, 410–412
sample application with inputs, 413–414
drag-and-drop application
app.component.html, 535
drag.component.css, 538
drag.component.html, 538
drag.component.ts, 538
drop.component.css, 537
drop.component.html, 537
drop.component.ts, 536
emitting custom events from, 458
image zoom application
app.component.html, 531
folder structure, 530
zoomit.component.css, 532
zoomit.component.html, 532
inline CSS and HTML in, 405–406
integrating custom services into, 503–504
selectors, defining, 404
separation of responsibilities, 393
star rating application
app.component.css, 544
app.component.ts, 543
app.module.ts, 540
folder structure, 539
mockbackend.service.ts, 540–541
rated-item.component.css, 545–546
rated-item.component.html, 545
rated-item.component.ts, 544–545
templates
components directives, 392, 442
compound indexes, 328
compress middleware, 368
compressing
concat() method, 30, 31, 33–34, 81
$concat operator, 287
concatenating buffers, 81
conditionals
if statements, 20
config method, 161
--config parameter (mongod command), 202
config servers, creating, 338
configuration
selectors, 404
HTTP requests, 471
MongoDB authentication, 210–211
query database operation, 299–302
connect() method, 56, 140, 147, 154, 223, 292
connected property (ChildProcess object), 166
connecting to MongoDB
MongoClient class, 222
write concern, 222
connectionTimeOut option (server object), 224
console, writing data to, 53–54
constant data service, 505–506
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), 394–395
continue event, 120
contributors directive, 47
converting
arrays to strings, 34
JavaScript objects to JSON, 74
JSON to JavaScript objects, 74
cookieParser middleware, 368, 373–374
cookies
cookieSession middleware, 368, 374–375
copy() method, 79
copyDatabase() method, 213
copying
databases, 213
count() method, 231, 233, 268–269, 300
$count operator, 285
cpus() method, 182
createAlert() method, 515
createCollection() method, 214, 228, 234, 237, 330
createConnection() method, 140
createDb() method, 481
createDelete.component.CSS listing, 479–480
createDelete.component.html listing, 479
createDelete.component.ts listing, 477–478
createReadStream() method, 105–106
createServer() method, 124, 126, 128, 136, 150, 154–156, 345
createTimedAlert() method, 515
createUser() method, 207, 208, 476, 478
createWriteStream() method, 101–102
crl option
htp.createServer(), 136
https.request(), 136
tls.createServer(), 155
csrf middleware, 368
CSS (Cascading Style Sheets)
files, 9
inline CSS in Angular applications, 405–406
listings
app.component.css, 454, 495, 513–514, 535–536, 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
outer.css, 411
rated-item.component.css, 545–546
./static/css/static.css, 370
zoomit.component.css, 532
curly braces ({ }), 20, 24, 429
currency pipe, 423
current database, changing, 211–212
custom Angular services, 503
constant data service, 505–506
app.component.html, 506
app.component.ts, 505
pi.service.ts, 505
data transform service, 506–510
app.component.css, 509
integrating into applications, 503–504
mock back-end service, 540–541
service that returns a promise, 515–516
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
variable data service, 510–514
app.component.html, 513
random-image.service.ts, 511–512
custom directives, 449
custom attribute directives, 449–452
custom component directives, 452–456
container component, 454
CSS for container component, 455
CSS for root component, 454
HTML for container component, 455
HTML for root component, 453–454
root component, 453
emitting from components, 458
handling with listeners, 458
implementing in nested components, 458–460
custom-defined objects, 28
customevent.component.html listing, 459–460
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
Dahl, Ryan, 39
data binding, 429
attribute binding, 433
definition of, 392
data changes, detecting with observables, 465–468
data I/O
compressing/decompressing, 91–92
concatenating, 81
determining length of, 78
encoding methods, 75
slicing, 80
JSON (JavaScript Object Notation), 73
converting JavaScript objects to, 74
converting to JavaScript objects, 74
streams, 81
compressing/decompressing, 92–93
Readable streams, 82–84, 89–90
Writable streams, 84–86, 89–90
data life cycles, 199
data passing with dependency injection, 412–413
Data property (route object), 487
data transform service, 506–510
app.component.css, 509
data types
data usability, 200
Database Administrator accounts, 211
databases (MongoDB). See also collections (MongoDB)
connecting to using Mongoose, 292–294
copying, 213
database change options, 241–242
db_create_list_delete.js sample application, 234–236
displaying list of, 211
implementing schemas on, 295–296
listing, 233
query database operation
repairing, 341
databases command, 204
data.service.ts listing, 476, 481–482
date pipe, 423
db() method, 227
db_connect_object.js listing, 226
db_connect_url.js listing, 225
db_create_list_delete.js listing, 234–236
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
decorators
@pipe, 426
defined parameters, applying route parameters with, 348
deflate() method, 91
deflateRaw() method, 91
delaying work
delete() method, 470
deleteChar() method, 461
findAndRemove() method, 257–258
remove() method, 217–218, 255–256
event listeners, 65
files, 110
MongoDB user accounts, 209
dependencies directive, 48
dependency injection
building nested components with, 410–412
sample application with inputs, 413–414
deploying
sharded MongoDB clusters, 338
adding shards to cluster, 339
config server database instances, 338
dereferencing timers, 63
description directive, 47
detached property (spawn() function), 170
details.component.css listing, 463
details.component.html listing, 463
details.component.ts listing, 462–463
detecting data changes, 465–468
diffieHellman class, 188
dir() function, 53
@directive class, 449
Directive class, 449
directives. See also commands
author, 47
bin, 47
attribute directives, 392, 445–448
components directives, 392, 442
structural directives, 392, 442–445
contributors, 47
custom directives, 449
custom attribute directives, 449–452
custom component directives, 452–456
definition of, 441
dependencies, 48
description, 47
engines, 48
keywords, 48
main, 47
name, 47
preferGlobal, 47
repository, 48
scripts, 47
version, 47
directories
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, 276–277
distinct() method, 231, 276–277, 300
$divide operator, 286
division (/) operator, 18
dns_lookup.js listing, 187–188
doc_aggregate.js listing, 288
doc_delete_one.js listing, 257–258
doc_delete.js listing, 255–256
doc_distinct.js listing, 277
doc_fields.js listing, 271–272
doc_insert.js listing, 245–246
doc_modify.js listing, 251
doc_paging.js listing, 273–274
doc_update.js listing, 249–250
doc_upsert.js listing, 253–254
doCalc() function, 26
doCircle() method, 507
Document Object Model. See DOM (Document Object Model)
documents (MongoDB)
adding
aggregating with Mongoose, 317–320
finding
find() method, 216
getting from collections, 246–248
growth of, 198
Mongoose Document object, 304–305
paths, 294
removing
findAndRemove() method, 257–258
remove() method, 217–218, 255–256
saving
TTY (time-to-live), 199
updating
findAndRemove() method, 218–219
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.html, 535
drag.component.css, 538
drag.component.html, 538
drag.component.ts, 538
drop.component.css, 537
drop.component.html, 537
drop.component.ts, 536
drag-item component
app.component.html, 535
drag.component.css, 538
drag.component.html, 538
drag.component.ts, 538
driver. See MongoDB Node.js driver
dropCollection() method, 228, 238
dropDatabase() method, 213, 228, 234
drop-item component
app.component.html, 535
drop.component.css, 537
drop.component.html, 537
drop.component.ts, 536
dropping. See deleting data
dummyDB.JSON listing, 472
each() method, 232
$each operator, 244
eCDH class, 188
EJS template
elements of arrays, adding/removing, 34–35
$elemMatch, 266
elemMatch() method, 304
$elemMatch operator, 264
emitter_listener.js listing, 66–67
emitting custom events, 458
enable() method, 344
enabled() method, 344
enableSharding() method, 339–340
encoding methods, 75
encoding property
exec() method, 167
execFile() method, 167
fork() function, 172
encrypt_password.js listing, 189
end() method, 85, 120, 122, 127, 142
endian, 75
endianness() method, 181
engine() method, 360
engines, template, 360
locals, adding, 361
rendered templates, sending, 363–364
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, 393–394
$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
throwing errors, 36
errors module, 41
errors property (Document object), 305
event listeners
adding to objects, 65
removing from objects, 65
event queue, scheduling work on, 59–60
event.component.ts listing, 436–438
EventEmitter object, 64–65, 458
eventHandler() method, 459
callbacks, 67
chaining, 70
implementing closure in, 68–69
ClientRequest object, 120
cluster module, 174
emitting from components, 458
handling with listeners, 458
implementing in nested components, 458–460
event listeners
adding to objects, 65
removing from objects, 65
event queue, scheduling work on, 59–60
IncomingMessage object, 123
process signals, 160
Readable streams, 82
ServerResponse object, 121
Worker object, 176
Writable streams, 84
events module, 41. See also events
execArgv method, 162
execPath method, 162
execPath property (fork() function), 172
executable files, executing on another process, 168–169
executables
mongod.exe, 202
Node.js executables, verifying, 42–43
executing
executable files on another process, 168–169
processes, 161
system commands on another process, 166–168
exist event, 165
$exists operator, 263
exit command, 204
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
installing, 343
assigning globally to path, 368
assigning to single route, 368
compress, 368
csrf, 368
favicon, 367
functions, 369
logger, 367
Response objects, 352
download responses, 359
redirection, 359
rendered templates in, 363–364
status, 353
routes
applying parameters in, 347–350
definition of, 345
implementing, 346
server, starting, 345
template engines, 360
locals, adding, 361
rendered templates, sending, 363–364
express_auth_one.js listing, 376
express_auth_session.js listing, 378–379
express_auth.js listing, 376
express_cookies.js listing, 373–374
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, 349–350
express_send_file.js listing, 358
express_send.js listing, 354
express_session.js listing, 374–375
express_static.js listing, 370
express_templates.js listing, 363–364
Component class interaction, 418–419
pipes
definition of, 422
of Angular, 14
external sources, interacting with, 132–134
external.component.ts listing, 409
external.css listing, 409
externalTemplate.html listing, 409
f (form feed) escape code, 30
--f parameter (mongod command), 202
$facet operator, 285
favicon middleware, 367
feed() function, 386
fields
distinct field values, finding, 276–277
naming conventions, 193
required fields, forcing, 296
unique fields, 296
fields option (options object), 264
asynchronous file system calls, 95
directories
renaming, 112
files
deleting, 110
renaming, 112
returning statistics about, 107–108
watching for file changes, 112–113
synchronous file system calls, 95
file_read_async.js listing, 105
file_read_stream.js listing, 106
file_read_sync.js listing, 103–104
file_readdir.js listing, 109–110
file_stats.js listing, 108
file_write_async.js listing, 100–101
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, 168–169
node, 42
reading
asynchronous file reading, 104–105
streamed file reading, 105–106
synchronous file reading, 103–104
renaming, 112
returning statistics about, 107–108
static files, serving, 125–127, 369–371
watching for file changes, 112–113
writing
asynchronous file writing, 99–101
simple file write, 98
streaming file writing, 101–102
synchronous file writing, 98–99
fill() method, 76
find() method, 216, 231, 246–248, 265–268, 299, 300, 306
findAndModify() method, 231, 250–251
findAndRemove() method, 231, 257, 300
findOne() method, 231, 246–248, 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
form feed escape code, 30
form parameters, processing, 117–118
formatGreeting() function, 25
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)
callback functions, 67
applying for defined parameters, 348–349
chaining, 70
implementing closure in, 68–69
defining, 24
returning values from, 25
$geoNear operator, 285
geospatial indexes, 328
get() method, 304, 344, 352, 470
GET requests
definition of, 9
response callback functions, 471
getCensoredWords() function, 52
getCharacters() method, 517
getConnections() method, 146
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, 544–545
getuid() method, 162
getWeather() function, 132
gid property (spawn() function), 170
Good Guys component
good-guys.component.css, 521
good-guys.component.html, 520
good-guys.component.ts, 520
$graphLookup operator, 285
greater than (>) operator, 19
greater than or equal to (>=) operator, 19
greeting() function, 25
$group operator, 284
growth of MongoDB documents, 198
gt() method, 303
$gt operator, 263
gte() method, 303
$gte operator, 263
gunzip() method, 91
gzip() method, 91
handshakeTimeout option (tls.createServer), 155
hash class, 189
hash property (URL object), 117
hash-based sharding, 337
hashed indexes, 329
head() method, 470
headers property (IncomingMessage object), 123
headersSent event, 121
help command, 204
--help parameter (mongod command), 202
Hex encoding, 75
hint() method, 302
hint option (options object), 264
hitCharacter() method, 517–520
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, 457–458
files, 9
inline HTML in Angular applications, 405–406
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, 459–460
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, 484–485
user_ejs.html, 362
zoomit.component.html, 532
router-outlet tag, 488
HTTP (Hypertext Transfer Protocol), 8, 115. See also http service
headers, 10
certificate signing request files, 135
HTTPS servers, 137
private keys, 135
query string and form parameter processing, 117–118
requests, 9
responses, 352
download responses, 359
IncomingMessage object, 122–123
redirecting, 359
rendered templates in, 363–364
ServerResponse object, 121–122
status, 353
servers
external sources, interacting with, 132–134
static files, serving, 125–127
URLs (Uniform Resource Locators)
resolving, 117
http module. See HTTP (Hypertext Transfer Protocol)
http service, 470
GET requests, sending, 470–471
JSON file implementation and access, 472–475
dummyDB.JSON, 472
http.component.html, 474
http.component.ts, 473
PUT requests, sending, 470–471
request configuration, 471
response callback functions, 471
simple mock server implementation, 475–481
app.module.ts, 480
createDelete.component.CSS, 479–480
createDelete.component.html, 479
createDelete.component.ts, 477–478
creating, 475
data.service.ts, 476
simple mock server updates, 481–486
update.component.html, 484–485
http_client_get.js listing, 128
http_client_post.js listing, 131
http_client_static.js listing, 126–127
http_server_external listing, 132–133
http_server_get.js listing, 128
http_server_post.js listing, 130
http_server_static.js listing, 126
http.component.CSS listing, 474–475
http.component.html listing, 474
http.component.ts listing, 473
HttpModule, importing, 473–474
certificate signing request files, 135
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)
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, 527–528
app.component.ts, 526
drag-and-drop application
app.component.html, 535
drag.component.css, 538
drag.component.html, 538
drag.component.ts, 538
drop.component.css, 537
drop.component.html, 537
drop.component.ts, 536
app.component.html, 531
folder structure, 530
zoomit.component.css, 532
zoomit.component.html, 532
immediate timers, 62
import keyword, 392
importing
modules, 392
ActivatedRoute, 488
AppRoutingModule, 488
imports metadata option (NgModule), 397
$inc operator, 243
IncomingMessage object, 122–123
increment (++) operator, 18
indexed arrays, 384
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, 185–186
initgroups() method, 163
InMemoryDbService, importing, 476, 481
InMemoryWebApiModule
implementing, 540
in() method, 303
inner.component.ts listing, 412
$in operator, 263
Input decorator, 412
input.component.ts listing, 413–414
insert() method, 217, 230, 244–246
installing
Express, 343
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
interpolation.component.ts listing, 430–431
intro.ts listing, 406
invalidate() method, 305
I/O
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
arrays
converting into strings, 34
iterating through, 34
searching, 34
conditionals
if statements, 20
error handling, 35
throwing errors, 36
functions, 24. See also individual functions (for example, doCalc() function)
callback functions, 67–70, 348–349
defining, 24
returning values from, 25
JSON (JavaScript Object Notation), 73
converting JavaScript objects to, 74
converting to JavaScript objects, 74
keywords
export, 392
import, 392
new, 27
styles, 405
styleUrls, 408
templateUrl, 408
loops, 21
do/while, 22
for/in, 23
while, 21
methods, 27. See also individual methods (for example, write() method)
objects, 27
converting JSON to, 74
converting to JSON, 74
custom-defined objects, 28
prototyping object patterns, 29
operators, 17
assignment operators, 18
isinstanceof, 184
statements
if, 20
return, 25
throw, 36
strings
combining, 31
converting arrays into, 34
replacing words in, 31
searching, 31
splitting, 32
variables
JavaScript Object Notation. See JSON (JavaScript Object Notation)
journal option, 242
JSON (JavaScript Object Notation), 73
converting JavaScript objects to, 74
converting to JavaScript objects, 74
file implementation and access, 472–475
dummyDB.JSON, 472
http.component.html, 474
http.component.ts, 473
json pipe, 423
jsonp callback name setting (Express), 344
jsonp replacer setting (Express), 344
jsonp spaces setting (Express), 344
keepAlive option (server object), 224
key option
tls.connect(), 154
tls.createServer(), 155
(keydown) event, 458
(keypress) event, 458
keys
private keys, generating, 135
(keyup) event, 458
keywords. See also statements
export, 392
import, 392
new, 27
styles, 405
styleUrls, 408
templateUrl, 408
this, 323
keywords directive, 48
killSignal property (exec() method), 167
$last operator, 286
leave() method, 527
length of buffers, determining, 78
less than (<) operator, 19
less than or equal to (<=) operator, 19
$limit operator, 284
limit option (options object), 264
limiting result sets, 270
listDatabases() method, 229, 233
listdb_connect_url.js, 225
listen() method, 124, 146, 345
listeners, 458
adding to objects, 65
removing from objects, 65
listeners() function, 65
listing
MongoDB server status, 236–237
MongoDB user accounts, 206–207
listings
animated.component.css, 529
animated.Component.html, 529
animated.component.ts, 527–528
app.component.css
AreaCalcService, 509
custom directive with component, 454
drag-and-drop application, 535–536
router with navigation bar, 495
star rating application, 544
app.component.html
animation application, 526–527
custom directive with component, 453–454
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, 543–544
app.component.ts
animation application, 526
custom directive with component, 453
drag-and-drop application, 534–535
image zoom application, 530–531
PiService, 505
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, 525–526
simple mock server implementation, 473–474, 480
simple router implementation, 488–489
star rating application, 540
app-routing.module.ts
router with navigation bar, 492–493
router with parameters, 498
simple router implementation, 489–490
attribute.component.css, 448
attribute.component.html, 447
attribute.component.ts, 446–447
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
censortext.js, 49
character.component.css, 462
character.component.html, 462
character.component.ts, 461–462
child_process_exec_file.js, 168–169
child_process_spawn_file.js, 170–171
class.component.ts, 434
classExpressions.component.ts, 418–419
collection_create_list_delete.js, 238–239
constructor.component.ts, 407
container.component.css, 455
container.component.html, 455
container.component.ts, 454
createDelete.component.CSS, 479–480
createDelete.component.html, 479
createDelete.component.ts, 477–478
customevent.component.html, 459–460
customevent.component.ts, 459
customPipes.component.ts, 427
custom.pipe.ts, 427
db_connect_object.js, 226
db_create_list_delete.js, 234–236
details.component.css, 463
details.component.html, 463
doc_aggregate.js, 288
doc_distinct.js, 277
doc_modify.js, 251
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
encrypt_password.js, 189
express_auth_one.js, 376
express_auth_session.js, 378–379
express_auth.js, 376
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_send_file.js, 358
express_send.js, 354
express_static.js, 370
external.component.ts, 409
external.css, 409
externalTemplate.html, 409
file_read_async.js, 105
file_read_stream.js, 106
file_stats.js, 108
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, 126–127
http_server_get.js, 128
http_server_post.js, 130
http_server_static.js, 126
http.component.html, 474
http.component.ts, 473
inner.component.ts, 412
interpolation.component.ts, 430–431
intro.ts, 406
mockbackend.service.ts, 540–541
mongoose_aggregate.js, 319
mongoose_connect.js, 293
mongoose_middleware.js, 323–324
mongoose_remove_many.js, 316
mongoose_remove_one.js, 315
mongoose_save.js, 310
mongoose_update_many.js, 313–314
mongoose_update_one.js, 312
mongoose_validation.js, 321
nav.component.CSS, 494
nav.component.html, 493
nav.component.ts, 493
observable.component.html, 467
observable.component.ts, 466–467
outer.component.ts, 411
outer.css, 411
outer.html, 411
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
promise.service.ts, 515
property.component.ts, 432
random-image.service.ts, 511–512
rated-item.component.css, 545–546
rated-item.component.html, 545
rated-item.component.ts, 544–545
readwords.js, 52
route2.component.html, 491
route2.component.ts, 491
./static/css/static.css, 370
stream_duplex.js, 87
stream_piped.js, 90
stream_write.js, 85
structural.component.ts, 443–444
style.component.ts, 435
typescriptExpressions.component.ts, 421
update.component.html, 484–485
user_ejs.html, 362
user.service.ts, 478–479, 483–484
word_schema.js, 297
zlib_file.js, 93
zoomit.component.css, 532
zoomit.component.html, 532
little endian, 75
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
logColorCar() function, 67
logger middleware, 367
--logpath parameter (mongod command), 203
lookup() method, 186
$lookup operator, 285
loops, 21
do/while, 22
for/in, 23
while, 21
lowercase pipe, 423
lt() method, 303
$lt operator, 263
$lte operator, 263
main directive, 47
manipulating
map() method, 471
MapReduce, 282. See also aggregating results
markModified() method, 305
$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
method property
ClientRequest object, 119
IncomingMessage object, 123
Request object, 351
methods. See also individual methods (for example, write() method)
definition of, 27
methods property (Schema object), 296
assigning globally to path, 368
assigning to single route, 368
compress, 368
csrf, 368
favicon, 367
functions, 369
logger, 367
Mongoose middleware functions, 322–324
middleware functions (Mongoose), 322–324
$min operator, 286
mkdir() method, 111
mkdirSync() method, 111
mock back-end service, 540–541
mock web servers
simple JSON file implementation, 472–475
dummyDB.JSON, 472
http.component.html, 474
http.component.ts, 473
simple mock server implementation, 475–481
app.module.ts, 480
createDelete.component.CSS, 479–480
createDelete.component.html, 479
createDelete.component.ts, 477–478
creating, 475
data.service.ts, 476
simple mock server updates, 481–486
update.component.html, 484–485
mockbackend.service.ts listing, 540–541
mod() method, 303
model() method, 298
models, compiling, 298
modifiedFields() method, 310
modifiedPaths() method, 305
modules (Angular), 392
importing
AppRoutingModule, 488
BrowserAnimationsModule, 526
Router, 492
routing module, 488
modules (Node.js)
assertion testing, 190
buffer. See buffers
C/C++ add-ons, 190
executable files, executing on another process, 168–169
system command, executing on another process, 166–168
cluster, 174
events, 174
methods, 175
properties, 175
definition of, 43
events. See events
express. See Express
fs. See file system
global, 190
http. See HTTP (Hypertext Transfer Protocol)
certificate signing request files, 135
HTTPS servers, 137
private keys, 135
installing, 46
loading into Node.js applications, 52–53
mongodb. See MongoDB Node.js driver
mongoose. See Mongoose
net, 41. See also socket services
process, 159
process execution, 161
process signals, 160
returning information from, 161–164
publishing to NPM Registry, 50–51
REPL (Read Event Print Loop), 190
searching for, 45
stream. See streams
isinstanceof operator, 184
V8, 190
Zlib, 91
compressing/decompressing buffers, 91–92
compressing/decompressing streams, 92–93
modules module, 41
modulus (%) operator, 18
MongoClient object, 222, 223–226
MongoDB, 192. See also MongoDB Node.js driver; Node.js-to-Angular stack
access control, 209
Database Administrator accounts, 211
User Administrator accounts, 209–210
access from shell client, 203–204
command parameters, 205
shell commands, 204
shell methods, 205
atomic write operations, 198
collections
accessing statistics for, 239–240
adding documents to, 217, 244–246, 307–309
atomically modifying documents in, 250–251
capped collections, 197–198, 330
collection_create_list_delete.js application example, 238–239
definition of, 192
deleting documents in, 217–218, 255–256
displaying list of, 214
enabling sharding on, 340
finding documents in, 216, 305–307
getting documents from, 246–248
listing, 237
number of, 199
removing documents from, 314–317
removing single document from, 257–258
saving documents in, 252–253, 310–311
updating documents in, 218–219, 248–250, 309–310
upserting documents in, 253–254
connecting to
MongoClient object, 222, 223–226
write concern, 222
data life cycles, 199
data usability and performance, 200
databases
connecting to using Mongoose, 292–294
copying, 213
database change options, 241–242
db_create_list_delete.js sample application, 234–236
displaying list of, 211
listing, 233
repairing, 341
distinct field values, finding, 276–277
documents
aggregating with Mongoose, 317–320
finding, 216, 265–268, 305–307
getting from collections, 246–248
growth of, 198
paths, 294
removing, 217–218, 255–256, 257–258, 314–317
TTY (time-to-live), 199
updating, 218–219, 248–250, 309–314
downloading, 202
MapReduce, 282
adding documents with, 307–309
aggregating documents with, 317–320
finding documents with, 305–307
models, compiling, 298
objects, 292
removing multiple documents with, 315–317
removing single documents with, 314–315
updating multiple documents with, 313–314
updating single documents with, 311–313
objects
Admin, 229
replication, 199
result sets, 270
limiting fields returned in, 271–272
server status, displaying, 236–237
sharding, 199
definition of, 334
enabling on collections, 340
enabling on databases, 339–340
hash-based sharding, 337
partitioning methods, 337
range-based sharding, 337
sharded MongoDB clusters, 338–339
sharding server types, 335
stopping, 203
user accounts
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, 239–240
collection_create_list_delete.js application example, 238–239
creating, 237
deleting, 238
listing, 237
database change options, 241–242
database update operators, 242–244
databases
creating, 234
db_create_list_delete.js sample application, 234–236
deleting, 234
listing, 233
distinct field values, finding, 276–277
documents
adding to collections, 244–246
finding specific sets of, 265–268
getting from collections, 246–248
saving in collections, 252–253
updating in collections, 248–250
Admin, 229
result sets, 270
limiting fields returned in, 271–272
mongod.exe, 202
mongodump command, 342
connecting to MongoDB with, 292–294
documents
models, compiling, 298
objects, 292
query database operation, 299–302
schemas
implementing on database, 295–296
paths, 294
required fields, forcing, 296
unique fields, 296
mongoose_aggregate.js listing, 319
mongoose_connect.js listing, 293
mongoose_create.js listing, 308–309
mongoose_find.js listing, 306–307
mongoose_middleware.js listing, 323–324
mongoose_remove_many.js listing, 316
mongoose_remove_one.js listing, 315
mongoose_save.js listing, 310
mongoose_update_many.js listing, 313–314
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, 315–317
updating with Mongoose, 313–314
multiplication (*) operator, 18
$multiply operator, 287
myCustomEvent, 459
(new line) escape code, 29
name directive, 47
nav.component.CSS listing, 494
nav.component.html listing, 493
nav.component.ts listing, 493
navigating routes, 488
navigation bar, router with, 492–497
app.component.CSS, 495
app.component.html, 494
app.component.ts, 494
app-routing.module.ts, 492–493
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, 410–412
net module, 41. See also socket services
Socket objects
data flow across, 144
networkInterfaces() method, 182
new keyword, 27
new line escape code, 29
new option, 242
newSession event, 156
nextObject() method, 232
nextTick() function, 63–64, 161
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
ngModel directive, 445
ngOnInit() method, 465, 482, 505, 531, 543
ngStyle directive, 445
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
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
compressing/decompressing, 91–92
concatenating, 81
determining length of, 78
encoding methods, 75
slicing, 80
child processes, 164
executable files, executing on another process, 168–169
system command, executing on another process, 166–168
companies using, 40
connecting to MongoDB from
write concern, 222
development of, 39
directories
renaming, 112
event queue, scheduling work on, 59–60
files
asynchronous file system calls, 95
deleting, 110
renaming, 112
returning statistics about, 107–108
synchronous file system calls, 95
watching for file changes, 112–113
HTTP services, 115
external sources, interacting with, 132–134
IncomingMessage object, 122–123
query string and form parameter processing, 117–118
ServerResponse object, 121–122
static files, serving, 125–127
URLs (Uniform Resource Locators), 115–117
certificate signing request files, 135
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
objects
checking type of, 184
converting to strings, 184–185
Stats, 107
process clusters, 174
events, 174
methods, 175
properties, 175
processes, 159
executable files, executing on another process, 168–169
process execution, 161
process signals, 160
returning information about, 161–164
system command, executing on another process, 166–168
streams, 81
compressing/decompressing, 92–93
Readable streams, 82–84, 89–90
Writable streams, 84–86, 89–90
strings
converting objects to, 184–185
timers, 60
dereferencing, 63
immediate timers, 62
use cases for, 40
Zlib, 91
compressing/decompressing buffers, 91–92
compressing/decompressing streams, 92–93
Node.js modules. See modules (Node.js)
Node.js-to-Angular stack, 7
web development framework
backend services, 10
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
NoSQL, 191–192. See also MongoDB
not (!) operator, 19
not equal (!=) operator, 19
$not operator, 263
NPM (Node Package Manager), 44–45
npm adduser, 50
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
Object Document Model (ODM). See Mongoose
object literals, 17
objects, 27
Admin, 229
converting into strings, 34
iterating through, 34
searching, 34
checking type of, 184
Collection. See collections (MongoDB)
converting JSON to, 74
converting to JSON, 74
converting to strings, 184–185
custom-defined objects, 28
event listeners
adding, 65
removing, 65
Observable
detecting data changes with, 465–468
properties, 27
prototyping object patterns, 29
query database operation, 299–302
Response, 352
download responses, 359
redirection, 359
rendered templates in, 363–364
status, 353
route, 487
Socket
data flow across, 144
Stats, 107
combining, 31
converting arrays into, 34
replacing words in, 31
searching, 31
splitting, 32
Observable object
detecting data changes with, 465–468
observable.component.html listing, 467
observable.component.ts listing, 466–467
observables
definition of, 464
Observable object
detecting data changes with, 465–468
ODM (Object Document Model). See Mongoose
once() function, 65
onDrop() method, 536
online event, 174
operators
JavaScript, 17
assignment operators, 18
isinstanceof, 184
MongoDB
$add, 286
$addFields, 285
$all, 264
$and, 263
$avg, 286
$bit, 244
$bucket, 285
$bucketAuto, 285
$collStatus, 284
$concat, 287
$count, 285
$divide, 286
$each, 244
$eq, 263
$exists, 263
$facet, 285
$first, 286
$geoNear, 285
$graphLookup, 285
$group, 284
$gt, 263
$gte, 263
$indexStats, 285
$last, 286
$limit, 284
$lookup, 285
$lt, 263
$lte, 263
$max, 286
$min, 286
$multiply, 287
$ne, 263
$nin, 263
$nor, 263
$not, 263
$or, 263
$out, 285
$pop, 243
$project, 284
$pull, 244
$pullAll, 243
$redact, 284
$regex, 264
$rename, 243
$replaceRoot, 285
$sample, 285
$set, 243
$setOnInsert, 243
$size, 264
$skip, 284
$slice, 244
$sortByCount, 285
$strcasecmp, 287
$substr, 287
$subtract, 287
$sum, 286
$toLower, 287
$toUpper, 287
$type, 263
$unset, 243
$unwind, 284
options object, 264–265, 275–276
or() method, 303
or (||) operator, 19
$or operator, 263
originalUrl property (Request object), 351
$out operator, 285
outer.component.ts listing, 411
outer.css listing, 411
outer.html listing, 411
outlet property (route object), 487
packages. See modules (Node.js)
page1.component.html listing, 499
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
param() method, 349
parameters
MongoDB shell commands, 205
passing to callback functions, 67–68
route parameters, applying, 347
with defined parameters, 348
express_routes.js example, 349–350
with regex, 348
router with parameters, 497–501
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, 461–464
parentheses ( ), 20, 24, 436, 457
parse() method, 74, 116, 117–118, 347
parseWeather() function, 132
parsing query strings, 117–118
partial option (options object), 265
partitioning methods, 337
passing data
with dependency injection, 412–413
parameters to functions, 67–68
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
pauseOnConnect option, 145
performance, MongoDB, 200
periodic work, scheduling
with immediate timers, 62
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 symbol (|), 426
pipes
built-in pipes
builtInPipes.component.ts, 425
definition of, 422
piping Readable streams to Writable streams, 89–90
app.component.html, 506
app.component.ts, 505
pi.service.ts, 505
pi.service.ts listing, 505
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, 322–324
POST requests
definition of, 9
pre middleware functions, 322–324
preferGlobal directive, 47
preventDefault() method, 536
primary servers, 330
private keys, 135
process execution, 161
process signals, 160
returning information from, 161–164
process property (Worker object), 176
process signals, 160
process_info.js listing, 163–164
processes, 159
executable files, executing on another process, 168–169
system command, executing on another process, 166–168
process clusters, 174
events, 174
methods, 175
properties, 175
process execution, 161
process signals, 160
returning information about, 161–164
profile command, 204
project() method, 318
$project operator, 284
promise.service.ts listing, 515
properties
ClientRequest object, 119
cluster module, 175
definition of, 27
IncomingMessage object, 123
Request object, 351
Worker object, 176
property.component.ts listing, 432
protocol property
Request object, 351
URL object, 116
prototyping object patterns, 29
providers metadata option (NgModule), 397
$pull operator, 244
$pullAll operator, 243
push() method, 33
put() method, 470
PUT requests
response callback functions, 471
queries
Mongoose Query object, 298–299
query database operation, 299–302
query strings, 41
applying route parameters with, 347–348
result sets, 270
limiting fields returned in, 271–272
query object (MongoDB), 262–264
Query object (Mongoose), 298–299
query database operation
query property
Request object, 351
URL object, 117
query router servers, 335, 338–339
query strings, 41
applying route parameters with, 347–348
queryRemover() function, 380
--quiet parameter (mongod command), 202
(carriage return) escape code, 29
app.component.html, 513
random-image.service.ts, 511–512
random-image.service.ts listing, 511–512
range-based sharding, 337
rated-item.component.css, 545–546
rated-item.component.html, 545
rated-item.component.ts, 544–545
RatedItem interface, 541
ratings.service.ts listing, 541–542
Read Event Print Loop (REPL) module, 41, 190
read() method, 82, 104–105, 302, 318
read option (Schema object), 295
read role (MongoDB), 208
readable event, 82
Readable streams, 82–84, 89–90
readAnyDatabase role (MongoDB), 208
readConcern option (server object), 224
readdir() method, 109
readdirSync() method, 109
reading files
asynchronous file reading, 104–105
streamed file reading, 105–106
synchronous file reading, 103–104
readInt8() method, 77
readInt16BE() method, 77
readInt16LE() method, 77
readline module, 41
readPreference option
options object, 265
server object, 224
readwords.js listing, 52
readWrite role (MongoDB), 208
readWriteAnyDatabase role (MongoDB), 208
ReconnectInterval option (server object), 224
reconnectTries option (server object), 224
$redact operator, 284
redirect() method, 359
redirecting responses, 359
redirectTo property (route object), 487
references, MongoDB documents, 195–196
regenerate() method, 378
regex, applying route parameters with, 348
regex() method, 303
$regex operator, 264
Registry, Node Package Registry
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, 314–316
removeHeader() method, 122
removeListener() function, 65
removeShardTag() method, 341
removeUser() method, 209, 228, 229
removing data. See deleting data
$rename operator, 243
renameCollection() method, 228
renameSync() method, 112
renaming files/directories, 112
rendered templates, sending, 363–364
--repair parameter (mongod command), 203
repairDatabase() method, 341
repairing databases, 341
REPL (Read Event Print Loop) module, 41, 190
$replaceRoot operator, 285
replacing words in strings, 31
replica sets, deploying, 333–334
replication
replications, 199
repository directive, 48
request event, 124
requestCert option (tls.createServer), 155
requests, 9
configuration, 471
request event, 124
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
redirection, 359
sending rendered templates in, 363–364
status, 353
responses
IncomingMessage object, 122–123
response event, 120
Response objects, 352
download responses, 359
redirection, 359
sending rendered templates in, 363–364
status, 353
ServerResponse object, 121–122
responsibilities, separation of, 393
result sets, 270
aggregate() method, 283
aggregation expression operators, 285–287
aggregation framework operators, 283–285
limiting fields returned in, 271–272
resumeSession event, 156
return statement, 25
return values, 25
rewind() method, 233
rmdir() method, 111
rmdirSync() method, 111
roles (MongoDB), 208
roles command, 204
root component (custom directive), 453
CSS for, 454
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, 492–497
app.component.CSS, 495
app.component.html, 494
app.component.ts, 494
app-routing.module.ts, 492–493
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, 497–501
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, 486–487
routing module, including, 488
simple router implementation, 488–491
app.component.ts, 490
app-routing.module.ts, 489–490
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
with defined parameters, 348
express_routes.js example, 349–350
with regex, 348
assigning Express middleware to, 368
definition of, 345
implementing, 346
Routes array, defining, 486–487
routing module, including, 488
runGaurdsAndResolvers property (route object), 487
safe() method, 302
safe option (Schema object), 295
$sample operator, 285
save() method, 217, 218–219, 230, 252–253, 305, 308, 310, 378
saving documents, 252–253, 310–311
scalability
scheduling work
timers, 60
dereferencing, 63
immediate timers, 62
schema property (Document object), 305
schemas
implementing on database, 295–296
paths, 294
required fields, forcing, 296
unique fields, 296
schemas metadata option (NgModule), 397
scripts, 205–206. See also listings
scripts directive, 47
search() method, 30
search property (URL object), 117
searching
arrays, 34
collections, 216
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, 353–355
sendData event, 121
sending
responses
download responses, 359
redirection, 359
separation of responsibilities, 393
serializeFunctions option, 242
Server object, 123–125, 144–147
server status, displaying, 236–237
servername option (tls.connect), 154
ServerResponse object, 121–122
servers. See also mock web servers
arbiter, 331
Express server, starting, 345
HTTP (Hypertext Transfer Protocol)
external sources, interacting with, 132–134
static files, serving, 125–127
HTTPS, 137
MongoDB server status, displaying, 236–237
primary servers, 330
query router servers, 335, 338–339
secondary servers, 331
shard servers, 335
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, 527–528
app.component.ts, 526
folder structure, 525
constant data service, 505–506
app.component.html, 506
app.component.ts, 505
pi.service.ts, 505
data transform service, 506–510
app.component.css, 509
definition of, 393
forms, 470
http, 470
GET requests, sending, 470–471
JSON file implementation and access, 472–475
PUT requests, sending, 470–471
request configuration, 471
response callback functions, 471
simple mock server implementation, 475–481
simple mock server updates, 481–486
integrating into applications, 503–504
mock back-end service, 540–541
purpose of, 469
router, 470
ActivatedRoute, importing, 488
route navigation, 488
route object parameters, 487
Router, importing, 488
router with navigation bar, 492–497
router with parameters, 497–501
routing module, including, 488
simple router implementation, 488–491
service that returns a promise, 515–516
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
variable data service, 510–514
app.component.html, 513
random-image.service.ts, 511–512
session middleware, 368, 377–380
sessionIdContext option (tls.createServer), 155
sessions
session authentication, 377–380
session middleware, 368
$set operator, 243
setgid() method, 162
setgroups() method, 163
setHeader() method, 122
setImmediate() function, 62
setKeepAlive() method, 143
setMaxListeners() function, 65
$setOnInsert operator, 243
setOptions() method, 301
setRating() method, 544
sets of documents, finding, 265–268
setSocketKeepAlive() method, 121
setTimeout() function, 60–61, 120, 122, 123, 143, 510
settings property (cluster module), 175
setuid() method, 162
setup event, 174
setupMaster() method, 175
sharding, 199
definition of, 334
enabling on collections, 340
enabling on databases, 339–340
hash-based sharding, 337
partitioning methods, 337
range-based sharding, 337
sharded MongoDB clusters, 338
adding shards to cluster, 339
config server database instances, 338
sharding server types, 335
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
SharedService. See shared service
shared.service.ts listing, 517–518
shell clients, accessing MongoDB from, 203–204
command parameters, 205
shell commands, 204
shell methods, 205
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, 61–62
simple_timer.js listing, 60–61
single documents
removing with Mongoose, 314–315
updating with Mongoose, 311–313
single field indexes, 328
size, limiting results by, 270–271
size() method, 304
$size operator, 264
size option (collections), 214
$skip operator, 284
skip option (options object), 264
$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
data flow across, 144
socket property (IncomingMessage object), 123
net.Socket object
data flow across, 144
socket_client.js listing, 148–149
socket_server.js listing, 151–152
socketPath property (ClientRequest object), 119
socketTimeOut option (server object), 224
soldierOfGondor() function, 388
sort() method, 33, 233, 302, 318
sort option (options object), 264, 275–276
$sortByCount operator, 285
spare property (indexes), 329
splice() method, 33
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.ts, 543
app.module.ts, 540
folder structure, 539
mockbackend.service.ts, 540–541
rated-item.component.css, 545–546
rated-item.component.html, 545
rated-item.component.ts, 544–545
starting
Express server, 345
statements. See also keywords
if, 20
return, 25
throw, 36
static files, serving, 125–127, 369–371
static middleware, 367, 369–371
./static/css/static.css listing, 370
statistics, accessing
collection statistics, 239–240
Stats object, 107
statsSync() method, 107
status of Response objects, 353
stdio property (spawn() function), 170
stopping MongoDB, 203
strategy, replication, 332–333
$strcasecmp operator, 287
stream module. See streams
stream_duplex.js listing, 87
stream_piped.js listing, 90
stream_transform.js listing, 88–89
stream_write.js listing, 85
streams, 81
compressing/decompressing, 92–93
Readable streams, 82–84, 89–90
streamed file reading, 105–106
streamed file writing, 101–102
Writable streams, 84–86, 89–90
strict option (Schema object), 295
strict routing setting (Express), 344
string decoder module, 41
combining, 31
converting arrays into, 34
replacing words in, 31
searching, 31
splitting, 32
strings, 16
converting objects to, 184–185
JavaScript
combining, 31
converting arrays into, 34
replacing words in, 31
searching, 31
splitting, 32
query strings, 41
applying route parameters with, 347–348
TypeScript, 383
Stringy interface, 385
structural directives, 392, 442–445
definition of, 441
ngFor, 442
ngSwitchDefault, 442
structural.component.ts, 443–444
structural.component.ts listing, 443–444
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
synchronous file reading, 103–104
synchronous file system calls, 95
synchronous file writing, 98–99
system command, executing on another process, 166–168
(tab) escape code, 30
tab escape code, 30
tags, router-outlet, 488
TCP (Transmission Control Protocol)
template engines, 360
locals, adding, 361
rendered templates, sending, 363–364
template option (components), 404
templates
template engines, 360
locals, adding, 361
rendered templates, sending, 363–364
templateUrl keyword, 408
templateUrl option (components), 404
text indexes, 328
this keyword, 323
throw statement, 36
throwing errors, 36
time() function, 53
timeEnd() function, 54
timeout event, 141
timeout property
exec() method, 167
options object, 265
dereferencing, 63
immediate timers, 62
time-to-live (TTY) values
documents, 199
indexes, 329
title method, 162
tls module, 41, 139–140, 152–153. See also socket services
tmpdir() method, 181
toArray() method, 232
toJSON() method, 305
$toLower operator, 287
toLowerCase() method, 31
toObject() method, 305
toPromise() method, 471, 472–473
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
Transmission Control Protocol. See TCP (Transmission Control Protocol)
truncateSync() method, 110–111
trust proxy setting (Express), 344
TTY (time-to-live) values
documents, 199
indexes, 329
twoWay.component.ts listing, 439–440
$type operator, 263
types. See data types
TypeScript, 383. See also listings
in Angular expressions, 419–422
classes
defining, 386
inheritance, 387
typescriptExpressions.component.ts listing, 421
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
$unset operator, 243
unshift() method, 33
unwind() method, 318
$unwind operator, 284
update() method, 218–219, 231, 248–250, 301, 304, 311, 313
update.component.CSS listing, 485–486
update.component.html listing, 484–485
update.component.ts listing, 482–483
updateRating() method, 541–542
updating
documents
findAndRemove() method, 218–219
mock web server items, 481–486
update.component.html, 484–485
uppercase pipe, 423
upsert option, 242
url property (IncomingMessage object), 123
URLs (Uniform Resource Locators), 41
resolving, 117
use command, 204
use() method, 368
user accounts (MongoDB)
removing, 209
roles, 208
User Administrator accounts, 209–210
user_ejs.html listing, 362
userAdmin role (MongoDB), 208
userAdminAnyDatabase role (MongoDB), 208
users command, 204
user.service.ts listing, 478–479, 483–484
utf8 encoding, 75
utf16le encoding, 75
util module, 183
isinstanceof operator, 184
util_inherit.js listing, 185–186
utilities module, 41
UUID() method, 205
validation framework (Mongoose), 320–322
validationAction option (collections), 215
validationLevel option (collections), 215
validator option (collections), 214
variable data service, 510–514
app.component.html, 513
random-image.service.ts, 511–512
variables
local template variables, 361
--verbose parameter (mongod command), 202
verify class, 189
verifying
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, 9–10
views setting (Express), 344
Visual Studio Code, 394
VM module, 41
void data type, 384
warn() function, 53
watching for file changes, 112–113
web applications. See components (Angular); services (Angular)
web browsers. See browsers
web development framework
backend services, 10
browsers, 8
browser-to-webserver communication, 8–9
user interaction, 10
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
timers, 60
dereferencing, 63
immediate timers, 62
worker property (cluster module), 175
workers property (cluster module), 175
Writable streams, 84–86, 89–90
write concern, 222
write() method, 76, 84–85, 118, 120, 122, 128, 142, 151
write operations, 198
writeContinue() method, 122
writeFile() method, 98
writeInt8() method, 76
writeInt16BE() method, 76
writeInt16LE() method, 76
writing
files
asynchronous file writing, 99–101
simple file write, 98
streaming file writing, 101–102
synchronous file writing, 98–99
wtimeout option, 241
wTimeOut option (server object), 224
compressing/decompressing buffers, 91–92
compressing/decompressing streams, 92–93
zlib_buffers.js listing, 91–92
zlib_file.js listing, 93
zoom application
app.component.html, 531
folder structure, 530
zoomit.component.css, 532
zoomit.component.html, 532
ZoomDirective export class, 451
zoom.directive.ts listing, 450–451
zoomit component
zoomit.component.css, 532
zoomit.component.html, 532
18.216.255.250