0% found this document useful (0 votes)
52 views

JS Concepts and API

This document outlines the topics that will be covered in Day 2 of a course on JavaScript concepts and APIs across different tiers using Express.js. The topics include file system I/O, Node APIs, patterns for managing asynchronous code, accessing data sources, architecture, and using the Express.js framework to build RESTful APIs.

Uploaded by

danielz_
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views

JS Concepts and API

This document outlines the topics that will be covered in Day 2 of a course on JavaScript concepts and APIs across different tiers using Express.js. The topics include file system I/O, Node APIs, patterns for managing asynchronous code, accessing data sources, architecture, and using the Express.js framework to build RESTful APIs.

Uploaded by

danielz_
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 87

JS Concepts & APIs

Day 2 Across The Tiers with Express.js

File System
I/O

File System
I/O
Node APIs

File System
I/O
Node APIs
Patterns for Managing
Async

File System
I/O
Node APIs
Patterns for Managing
Async
Accessing Data
Sources

File System
I/O
Node APIs
Patterns for Managing
Async
Accessing Data
Sources
Architectur
e

File System
I/O
Node APIs
Patterns for Managing
Async
Accessing Data
Sources
Architectur
e
Express.js
Framework

File System
I/O
Node APIs
Patterns for Managing
Async
Accessing Data
Sources
Architectur
e
Express.js
Framework
RESTful API

Filesystem I/O

Filesytem - Basic I/O

Filesystem - Synchronous vs. Asynchronous

Filesystem - Synchronous vs. Asynchronous

how-to sample

Day 2 Quiz 1
Fork & Answer Questions

Async Patterns

Callbacks

Node API - Callbacks

Node API - Callbacks

Node API - Callbacks

Node API - Callbacks, The Node Way

Node API - Callbacks, The Node Way

Promises

fulfilled

rejected

pending

settled

Node API - Promises Instantiation

Node API - Promises Usage

how-to sample

Day 2 Quiz 2
Fork & Answer Questions

Node APIs

Node API - Event Emitter

push notifications
SSE or Server Sent Events

web sockets
Web Sockets

primus
realtime framework

Node API - Socket.io

Buffers

Buffers
JavaScript doesnt
speak binary data.

Filesystem
Raw data is stored in
instances of the
Buffer Class.

TCP Streams
Manipulates, creates,
and consumes octet
streams.

new Buffer(size)

new Buffer(array)

new Buffer(buffer)

new Buffer(str[, encoding])

for 7 bit ASCII data only. This encoding


'ascii
method is very fast, and will strip the
'
'utf8 high bit if set.
'
'utf16l
e'
'ucs2
'
'base64
'
'binar
y'
'hex
'

'ascii
'
Multibyte encoded Unicode characters.
'utf8 Many web pages and other document
'
formats
use
UTF-8.
'utf16l
e'
'ucs2
'
'base64
'
'binar
y'
'hex
'

'ascii
'
'utf8
2 or 4 bytes, little endian encoded
'
'utf16l Unicode characters. Surrogate pairs
e'
(U+10000 to U+10FFFF) are
'ucs2
supported.
'
'base64
'
'binar
y'
'hex
'

'ascii
'
'utf8
'
'utf16l
e'
'ucs2
Alias of 'utf16le'.
'
'base64
'
'binar
y'
'hex
'

'ascii
'
'utf8
'
'utf16l
e'
'ucs2
'
'base64
Base64 string encoding.
'
'binar
y'
'hex
'

'ascii
'
'utf8
'
'utf16l
e'
'ucs2
A
way
of
encoding
raw
binary
data
into
'
'base64strings by using only the first 8 bits of
each character. This encoding method
'
'binar is deprecated and should be avoided in
y'
favor
of
Buffer
objects
where
possible.
'hex
This
encoding
will
be
removed
in
'

future versions of Node.

'ascii
'
'utf8
'
'utf16l
e'
'ucs2
'
'base64
'
'binar
y'
'hex Encode each byte as two
'
hexadecimal characters.

Streams

Node API - Streams

Node API - Streams

Node API - Streams

how-to sample

Day 2 Quiz 3
Fork & Answer Questions

Data Sources

Connectors & Sources

how-to sample

data structures
Alternates A.K.A. NoSQL

key/value

graph

time series

database architecture

Day 2 Quiz 4
Fork & Answer Questions

Architecture

event loop

node clustering

Load Balancing
Manually

Load Balancing
AWS Example

Load Balancing
AWS Example Expanded

Automated Testing

Message Queues & Cache Services

Node.js Middleware Pattern

how-to sample

Day 2 Quiz 5
Fork & Answer Questions

Express
Framework

MVC

Model

View

Controller

SPAs

APIs

Express.js - Installing & Project Setup

Express.js - Application Generator

Express.js - Application Generator

Express.js - Application Generator

how-to sample

Day 2 Quiz 6
Fork & Answer Questions

RESTful APIs

What is an API?
In web parlance an API is a simple interface
that will perform a particular action.

SOA Revisited?
Service Oriented Architecture often comes to
mind with the correlation to micro-services
and related API driven design ideas.

HTTP Verbs

GET

POST

PUT

UPDATE

End Points

GET /tickets - Retrieves a list of


tickets
GET /tickets/12 - Retrieves a specific
ticket
POST /tickets - Creates a new
ticket
PUT /tickets/12 - Updates ticket
#12
PATCH /tickets/12 - Partially updates
ticket #12
DELETE /tickets/12 - Deletes ticket
#12

how-to sample

Day 2 Quiz 7
Fork & Answer Questions

You might also like