Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

Nikita Galkin Love and Know: ▰ How to make developers and business happy ▰ Technical and process debt elimination Believe that: ▰ Any problem must be solved at the right level ▰ Software is easy. People are hard ▰ A problem should be highlighted, an idea should be "sold", a solution should be demonstrated Links: Site GitHub Twitter Facebook 2

Slide 3

Slide 3 text

▰ Telegram channel, daily ▰ Voice chat, weekly ▰ Workshops, coming soon

Slide 4

Slide 4 text

Today Agenda 1. What is special about Node.js? 2. Node.js v16 features 3. Node.js ecosystem state 4. What to learn?

Slide 5

Slide 5 text

What is special about Node.js?

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

Google pays for V8

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

Node.js v16: ECMAScript

Slide 11

Slide 11 text

8.4 ➜ 9.4

Slide 12

Slide 12 text

1. String.prototype.replaceAll 2. Object.hasOwn 3. ArrayLike.at 4. class static initialization blocks 5. Error cause 6. ...

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

Error cause:

Slide 17

Slide 17 text

Node.js v16: Timers Promises API

Slide 18

Slide 18 text

// Before function wait(timeout) { return new Promise((r) => setTimeout(r, timeout)); } // Node.js v16 import {setTimeout as wait } from "timers/promises"; async function example() { await wait(5000); console.log('After 500ms'); } example();

Slide 19

Slide 19 text

import { setInterval, } from 'timers/promises'; const interval = 100; for await (const startTime of setInterval(interval, Date.now())) { const now = Date.now(); console.log(now); if ((now - startTime) > 1000) break; }

Slide 20

Slide 20 text

Node.js v16: AbortController

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

const http = require('http'); const ac = new AbortController(); const signal = ac.signal; http.request('https://example.org', { signal }, (res) => { /** … **/ }); // Cancel the request! ac.abort();

Slide 23

Slide 23 text

Node.js v16: core modules

Slide 24

Slide 24 text

// Before import http from 'http'; // Node.js v16 import http from 'node:http';

Slide 25

Slide 25 text

Node.js v16: Source Maps

Slide 26

Slide 26 text

node:net:1420 throw new ERR_SERVER_ALREADY_LISTEN(); ^ Error [ERR_SERVER_ALREADY_LISTEN]: Listen method has been called more than once without closing. at new NodeError (node:internal/errors:371:5) at Server.listen (node:net:1420:11) at Object. (/Users/example.js:10:8) at Module._compile (node:internal/modules/cjs/loader:1101:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:17:47 { code: 'ERR_SERVER_ALREADY_LISTEN' }

Slide 27

Slide 27 text

// Before npm install source-map-support // Node.js v16 node server.js --enable-source-maps // or use env var NODE_OPTIONS="--enable-source-maps"

Slide 28

Slide 28 text

Node.js v16: npm

Slide 29

Slide 29 text

Corepack: the Node.js' manager of package managers

Slide 30

Slide 30 text

1. npm install as fast as yarn 2. package-lock.json v2 format 3. npm exec 4. workspaces 5. overrides (resolutions from yarn) are in development

Slide 31

Slide 31 text

Node.js v16: other

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

AsyncLocalStorage and AsyncResource API are stable now. Perfect use case: tracing

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

Running x86 vs arm64 node resulted in a ~40% improvement. Node.js v16 has darwin-x64 (Intel) and darwin-arm64 (Apple Silicon) builds

Slide 36

Slide 36 text

Node.js 16 supports setting process.env.TZ on windows. Farewell set-tz package process.env.TZ = 'UTC'

Slide 37

Slide 37 text

Node.js ecosystem

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

- TypeScript - GitHub - npm - Azure Most Affecting Company

Slide 40

Slide 40 text

Top Contributor - Fastify - pino - Node - undici

Slide 41

Slide 41 text

Open Source Startups Funding ● Gatsby – round B, May 2020, 28m ● Strapi – round A, may 2020, 10m ● Cube Dev – round A, Jul 2021, 15.5m ● Bubble – round A, Jul 2021, 100m ● Apollo – round D, Aug 2021, 130m ● Vercel – round D, Nov 2021, 150m

Slide 42

Slide 42 text

What to learn?

Slide 43

Slide 43 text

Required by industry ● EcmaScript & TypeScript ● DevOps: CI/CD, IoS, 12factor ● Cloud Native: one of AWS, GCP, Azure and Kubernetes ● Web API: OpenAPI, GraphQL, AsyncAPI, etc

Slide 44

Slide 44 text

Required by Business ● Soft Skills (English!) ● Reporting and analytics (Mixpanel) ● Headless CMS ● NoCode: use, integrate or migrate ● Personalization: Internet Of Behavior

Slide 45

Slide 45 text

QUESTIONS TIME! Slides at the channel ➡