M. Kodirov

STAGE 03 / LESSON 01

Node.js and asynchronous I/O

Node.js runs JavaScript outside the browser and is commonly used for web servers.

THE IDEA

Understand it.

Node.js provides runtime APIs for tasks such as HTTP, files and networking. Its event loop coordinates JavaScript callbacks and asynchronous operations; a long CPU-bound function can still block the main JavaScript thread.

Promises and async/await make asynchronous work easier to compose. Handle failures and set timeouts for external operations; async does not mean an operation can never block or fail.

SEE IT IN CONTEXT

A small HTTP server

import { createServer } from "node:http";

createServer((request, response) => {
  response.writeHead(200, { "Content-Type": "application/json" });
  response.end(JSON.stringify({ status: "ok" }));
}).listen(3000);

The request handler returns a JSON response. This is a minimal example, not a complete production API.

LEARN FROM REAL WEBSITES

See it in the real world.

These simplified structures come from public sources. Company systems change, and the sources may describe only one project or an earlier design.

Netflix

Netflix engineering, 2014

Node.js for an experiment platform

Netflix described migrating its website UI layer to Node.js and building patterns for A/B testing.

  1. Netflix.com UI
  2. Node.js patterns
  3. A/B tests

What to learn: A JavaScript runtime can support server-side work. This is a historical 2014 engineering example.

Read the source: Netflix A/B testing with Node.js

PayPal

Tutorial checked November 2026

Node.js in a checkout example

PayPal provides a developer integration guide with a Node.js backend option for checkout.

  1. Checkout application
  2. Example Node.js backend
  3. PayPal API

What to learn: Node can receive application requests and call another service. This is an integration example, not PayPal's internal architecture.

Read the source: PayPal Node.js checkout guide

TRY IT YOURSELF

Practice.

What happens to other requests if a handler performs a long synchronous computation?

Show one possible answer

It can block the JavaScript thread and delay other work. Move or redesign expensive CPU work rather than assuming async I/O makes it harmless.

GO DEEPER

Official references.