Web Development with Node.js

29
Web Development with Node.js From simple to scalable

Transcript of Web Development with Node.js

Page 1: Web Development with Node.js

Web Development with Node.jsFrom simple to scalable

Page 2: Web Development with Node.js

OverviewWeb fundamentals

Architecture

DOM

Introduction to JavaScriptHistory

ECMAScript 5

ES2015 (ES6)

Babel

Quirks

Page 3: Web Development with Node.js

Overview (cont)Introduction to Node.js

History

Node API

NPM

Quick Introduction to Git and Github

Hands-on exercisesSimple Web Server (Hello, World!)

Data Driven App (CRM)

ScalabilitySystem Architecture

Test, Standardize, and Monitor

Questions?

Page 4: Web Development with Node.js

Who am I?

Lead Developer - Information Technology Solutions Center

Senior - Information Technology: Software Development track

Originally from Columbus, OH

Developing web applications with Node.js since 2013

Page 5: Web Development with Node.js

Web Fundamentals - Architecture

Page 6: Web Development with Node.js

Web Fundamentals

1.Enter URL in address bar

2.If not cached, URL will be resolved to an IP address using a Domain Name System (DNS)

3.Web server receives and handles request

4.Web server responds with payload (HTML, CSS, JS, images, etc.)

5.Browser receives request and renders response

Page 7: Web Development with Node.js

Web Fundamentals - DOM

Document Object Model

A way of representing the HTML

Tree structure

Accessible via a JavaScript API

Can be easily manipulated

Page 8: Web Development with Node.js

Web Fundamentals - DOM

Page 9: Web Development with Node.js

Introduction to JavaScript - History

Brendan Eich - May 23, 1995

Netscape

Developed in 10 days

Mocha - LiveScript - JavaScript

European Computer Manufacturers Association (ECMA)

Page 10: Web Development with Node.js

Introduction to JavaScript - History

Submitted for standardization - November 1996

1st Edition - June 1997

2nd Edition - June 1998

3rd Edition - December 1999

4th Edition - Abandoned

5th Edition - December 2009

6th Edition - June 2015 - Current Standard

7th Edition - In Development

Page 11: Web Development with Node.js

Introduction to JavaScript - History

Stage 0 - Strawman

Stage 1 - Proposal

Stage 2 - Draft

Stage 3 - Candidate

Stage 4 - Finished

Page 12: Web Development with Node.js

Introduction to JavaScript - ECMAScript 5

Dynamically typed

Prototype-based

Functions are first class citizens

Event loop

Single threaded

Asynchronous

Concurrent

Page 13: Web Development with Node.js

Introduction to JavaScript - ECMAScript 5

Number

String

Boolean

Symbol (New in the 6th Edition)

Object (Function, Array, Date, RegExp)

null

Undefined

Page 14: Web Development with Node.js

Introduction to JavaScript - ECMAScript 5

+

-

*

/

%

< and >

<= and >=

== and ===

Page 15: Web Development with Node.js

Introduction to JavaScript - ECMAScript 5

if

else

else if

while

do-while

switch

Page 16: Web Development with Node.js

Introduction to JavaScript - ES2015 (ES6)

Arrow function

Promises

Classes

Enhanced Object Literals

Template Strings

Destructuring

Default + Rest + Spread

Let + Const

Iterators + For..Of

Page 17: Web Development with Node.js

Introduction to JavaScript - ES2015 (ES6)

Generators

Modules

Map + Set + WeakMap + WeakSet

Proxies

Symbols

Math + Number + String + Array + Object APIs

Binary and Octal Literals

Page 18: Web Development with Node.js

Introduction to JavaScript - Babel

Transpiler + Polyfill

ES2015+

Transpile or require hook

JSX, TypeScript, and more

Page 19: Web Development with Node.js

Introduction to JavaScript - Quirks

Implicit conversion

undefined and null

Normal equality (==)

Dot and Bracket notation

Page 20: Web Development with Node.js

Introduction to Node.js - History

Netscape Enterprise Server - December 1995

Node.js - 2009 - Ryan Dahl

Joyent

Google’s V8 Engine

io.js fork - December 2014 - “The Great Split”

Node.js Foundation - June 2015

Node.js and io.js merge - September 2015

Page 21: Web Development with Node.js

Introduction to Node.js - Node API

Cluster

Crypto

DNS

File System

HTTP/HTTPS

Modules

Net

Process

https://nodejs.org/docs/v4.4.2/api/

Page 22: Web Development with Node.js

Introduction to Node.js - NPM

Built in 2009

npm, Inc - Founded in 2014

“The” package manager for Node.js

Command-line tool to install and publish packages

package.json

node_modules

Page 23: Web Development with Node.js

Quick Introduction to Git and Github

Development began in April 2005

Distributed revision control system

Linus Torvalds

Github - Hosted git solution

Founded February 2008

Offers free and paid plans

Page 24: Web Development with Node.js

Hands-on Exercises - Simple Web Server

Handle HTTP requests

Retrieve data from the request

Respond with HTML

Respond with JSON

Page 25: Web Development with Node.js

Hands-on Exercises - Data Driven App

Serve rendered HTML

Interact with database (PostgreSQL)

Authentication

Add featuresSign up

Update customer information

Write test

Page 26: Web Development with Node.js

Scalability - System Architecture

Linux

Nginx/HAProxy

pm2/Docker

DBaaS (Amazon RDS)

PaaS (Amazon Elastic Beanstalk)

Microservices

Messaging systems (RabbitMQ)

Page 27: Web Development with Node.js

Scalability - Test, Standardize, and Monitor

Linters (ESLint, JSLint, JSHint, etc)

Code Analysis (Bithound, Codacy, etc)

Unit Testing (Mocha, Jest, etc)

Browser testing (Nightwatch.js, Protractor, etc)

Continuous Integration/Delivery (Jenkins, Travis-CI, Drone, etc)

Error Logging (Sentry, Airbrake, Rollbar, etc)

Application Monitoring (AppDynamics, New Relic, etc)

Page 28: Web Development with Node.js

Questions?

Page 29: Web Development with Node.js

Sources

https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript

https://en.wikipedia.org/wiki/JavaScript#History

http://www.2ality.com/2015/11/tc39-process.html

https://github.com/lukehoban/es6features

https://en.wikipedia.org/wiki/Node.js#History

https://en.wikipedia.org/wiki/Git_(software)