js concepts and api
TRANSCRIPT
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 1/87
Day 2 Across The Tiers with Express.js JS Concepts & APIs
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 2/87
File System
I/O
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 3/87
Node APIs
File System
I/O
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 4/87
Node APIs
Patterns for ManagingAsync
File System
I/O
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 5/87
ccessing DataSources
Node APIs
Patterns for ManagingAsync
File System
I/O
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 6/87
ccessing DataSources
rchitecture
Node APIs
Patterns for ManagingAsync
File System
I/O
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 7/87
ccessing DataSources
Express!sFrame"or#
rchitecture
Node APIs
Patterns for ManagingAsync
File System
I/O
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 8/87
ccessing DataSources
Express!sFrame"or#
$ES%ful API
rchitecture
Node APIs
Patterns for ManagingAsync
File System
I/O
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 9/87
Filesystem I!
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 10/87
Filesytem " #asic I!
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 11/87
Filesystem " Synchrono$s %s. Asynchrono$s
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 12/87
Filesystem " Synchrono$s %s. Asynchrono$s
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 13/87
how"to sample
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 14/87
For & Answer '$estionsDay 2 '$i( )
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 15/87
Async Patterns
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 16/87
Call*acs
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 17/87
+o,e API " Call*acs
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 18/87
+o,e API " Call*acs
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 19/87
+o,e API " Call*acs
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 20/87
+o,e API " Call*acs- The +o,e ay
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 21/87
+o,e API " Call*acs- The +o,e ay
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 22/87
Promises
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 23/87
/$l0lle,
&
pen,in1'
(
rejecte,
settle,)
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 24/87
+o,e API " Promises Instantiation
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 25/87
+o,e API " Promises sa1e
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 26/87
how"to sample
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 27/87
For & Answer '$estionsDay 2 '$i( 2
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 28/87
+o,e APIs
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 29/87
+o,e API " E%ent Emitter
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 30/87
SSE or Ser%er Sent E%ents
p$sh noti0cations
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 31/87
e* Socets
we* socets
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 32/87
realtime /ramewor
prim$s
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 33/87
+o,e API " Socet.io
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 34/87
#$3ers
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 35/87
4anip$lates- creates-an, cons$mes octetstreams.
5aw ,ata is store, ininstances o/ the#$3er Class.
Ja%aScript ,oesn6tspea *inary ,ata.
TCP Streams
Filesystem
#$3ers
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 36/87
new #$3er7si(e8
&
new #$3er7*$3er8'
(
new #$3er7array8
new #$3er7str9- enco,in1:8)
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 37/87
*ucs&*
*+inar**hex*
*+ase,)*
*utf-**utf(,le*
*ascii*
/or ; *it ASCII ,ata only. This enco,in1metho, is %ery /ast- an, will strip the
hi1h *it i/ set.
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 38/87
*ucs&*
*+inar**hex*
*+ase,)*
*utf-**utf(,le*
*ascii*
4$lti*yte enco,e, nico,e characters.4any we* pa1es an, other ,oc$ment/ormats $se TF"<.
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 39/87
*ucs&*
*+inar**hex*
*+ase,)*
*utf-**utf(,le*
*ascii*
2 or = *ytes- little en,ian enco,e,nico,e characters. S$rro1ate pairs7>)???? to >)?FFFF8 ares$pporte,.
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 40/87
*ucs&*
*+inar**hex*
*+ase,)*
*utf-**utf(,le*
*ascii*
Alias o/ @$t/)le@.
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 41/87
*ucs&*
*+inar**hex*
*+ase,)*
*utf-**utf(,le*
*ascii*
#ase= strin1 enco,in1.
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 42/87
*ucs&*
*+inar**hex*
*+ase,)*
*utf-**utf(,le*
*ascii*
A way o/ enco,in1 raw *inary ,ata intostrin1s *y $sin1 only the 0rst < *its o/each character. This enco,in1 metho,
is ,eprecate, an, sho$l, *e a%oi,e, in/a%or o/ #$3er o*jects where possi*le.This encoding will be removed infuture versions of Node.
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 43/87
*ucs&*
*+inar**hex*
*+ase,)*
*utf-**utf(,le*
*ascii*
Enco,e each *yte as twohexa,ecimal characters.
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 44/87
Streams
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 45/87
+o,e API " Streams
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 46/87
+o,e API " Streams
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 47/87
+o,e API " Streams
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 48/87
how"to sample
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 49/87
For & Answer '$estionsDay 2 '$i( B
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 50/87
Data So$rces
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 51/87
Connectors & So$rces
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 52/87
how"to sample
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 53/87
Alternates A..A. +oS'
,ata str$ct$res
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 54/87
#ey/.alue
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 55/87
graph
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 56/87
time series
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 57/87
,ata*ase architect$re
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 58/87
For & Answer '$estionsDay 2 '$i( =
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 59/87
Architect$re
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 60/87
e%ent loop
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 61/87
no,e cl$sterin1
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 62/87
4an$ally
oa, #alancin1
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 63/87
AS Example
oa, #alancin1
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 64/87
AS Example Expan,e,
oa, #alancin1
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 65/87
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 66/87
A$tomate, Testin1
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 67/87
4essa1e '$e$es & Cache Ser%ices
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 68/87
+o,e.js 4i,,leware Pattern
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 69/87
how"to sample
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 70/87
For & Answer '$estionsDay 2 '$i(
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 71/87
ExpressFramewor
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 72/87
4o,el
4C
Controlleriew
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 73/87
SPAs
&
(
APIs
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 74/87
Express.js " Installin1 & Project Set$p
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 75/87
Express.js " Application Generator
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 76/87
Express.js " Application Generator
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 77/87
Express.js " Application Generator
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 78/87
how"to sample
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 79/87
For & Answer '$estionsDay 2 '$i(
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 80/87
5EST/$l APIs
hat is an APIH
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 81/87
In we* parlance an API is a simple inter/acethat will per/orm a partic$lar action.
Ser%ice !riente, Architect$re o/ten comes tomin, with the correlation to micro"ser%icesan, relate, API ,ri%en ,esi1n i,eas.
hat is an APIH
S!A 5e%isite,H
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 82/87
TTP er*s
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 83/87
GET
&
PT'
(
P!ST
PDATE'
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 84/87
En, Points
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 85/87
P% /tic#ets/(& 0 pdates tic#et1(&
DE2E%E /tic#ets/(& 0 Deletes tic#et1(&
PA%34 /tic#ets/(& 0 Partially updatesic#et 1(&
5E% /tic#ets/(& 0 $etrie.es a speci6cic#et
POS% /tic#ets 0 3reates a ne"
ic#et
5E% /tic#ets 0 $etrie.es a list of
ic#ets
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 86/87
how"to sample
8/8/2019 JS Concepts and API
http://slidepdf.com/reader/full/js-concepts-and-api 87/87
For & Answer '$estionsDay 2 '$i( ;