Introduction & Learning Goals

🎯 What You'll Learn

🌐 HTTP Protocol
  • Client-server architecture
  • Request/response cycle
  • Status codes & headers
JavaScript Core
  • Functions, objects & arrays
  • Async: Promises & async/await
  • Modern ES6+ syntax
🖥️ Browser APIs
  • DOM manipulation
  • Events & event handling
  • Fetch API & AJAX
🚀 Node.js
  • Server-side JavaScript
  • File system & modules
  • Building APIs
📚 Course Flow
HTTP Basics JS Refresher Browser Node.js
  • Understand how the web works: clients, servers, and HTTP.
  • Refresh core JavaScript concepts and modern patterns.
  • Apply JavaScript in the browser (DOM) and on the server (Node.js).

Web Foundations: HTTP

👥 Understanding the Actors

Every HTTP request involves a client and a server

🔄 Roles per request

A client starts a request; a server answers. In chains (your server → external API) the roles switch per hop.

Why ports

One IP, many apps. The OS delivers packets to the process bound to the destination port.

DNS → IP

Resolve example.com to an IP (cached by TTL). CDNs often answer with a nearby edge.

Connect, then HTTP

TCP 3‑way → TLS (for HTTPS) → send request line + headers → receive response.

Advanced: routing & sockets
  • Reverse proxy routing: 443 (Nginx) can route api.example.comlocalhost:8000, www.example.comlocalhost:3000, assets → localhost:9000.
  • Ephemeral client ports: Each connection is a 4‑tuple (clientIP:clientPort ⇄ serverIP:serverPort), e.g. 198.51.100.24:53214 ⇄ 203.0.113.10:443.
  • Anycast/CDN: One advertised IP maps to multiple edges; DNS and BGP steer you to a close POP.

Anatomy of HTTP Messages

A message = start line + headers + optional body. Each part has distinct semantics. Dive deeper for framing, wire format, and caching implications.

Status Codes: Semantics & Strategy

Status codes drive caching, retries, SEO, monitoring and auth flows before any body is read. Use precise codes consistently; guesswork costs performance.

Headers & Content Types (Quick View)

Headers = metadata; start line + headers often decide caching, routing, auth before body is read. Content type tells parsers how to treat the body.

  • Negotiation: Accept, Content-Type
  • Caching: Cache-Control, ETag, validators
  • Auth: Authorization, WWW-Authenticate
  • Session: Cookie, Set-Cookie
  • Compression: Accept-Encoding/Content-Encoding
  • Trace: Traceparent, X-Request-ID
  • Representation: JSON, HTML, multipart, binary

Communication Examples

GET Request

A simple GET request to fetch a list of users. The client specifies it accepts JSON responses.

GET /api/users HTTP/1.1
Host: example.com
Accept: application/json

POST Request

A POST request to create a new user. The body contains JSON data with the user's information.

POST /api/users HTTP/1.1
Host: example.com
Content-Type: application/json

{"name":"Mehdi","role":"student"}

Server Response

A successful response with caching headers, compression, and an ETag for future revalidation.

HTTP/1.1 200 OK
Date: Thu, 06 Nov 2025 10:11:12 GMT
Server: example-app
Content-Type: application/json; charset=utf-8
Cache-Control: max-age=60, public
ETag: "users:v1:af31b2"
X-Request-ID: 8b7c2f55-91d7-4e6a-8209-9f8a1f4c1c21
Content-Encoding: br

[{"id":1,"name":"Mehdi"},{"id":2,"name":"Ada"}]

Reading the response without the body: Status + headers already tell success, cacheability, compression, and revalidation strategy (ETag). Monitoring often ignores the body.

JavaScript Overview

⚙️ How JavaScript Works

📝
Your Code
.js files
🔧
JS Engine
V8, SpiderMonkey
Execution
Machine code
Single-Threaded
One task at a time
Event Loop
Handles async operations
ECMAScript
Language standard
Non-Blocking
Async I/O operations

Engines & the Language

JS engines (like V8, SpiderMonkey) implement the ECMAScript standard. JS is single‑threaded with an event loop; asynchronous work uses callbacks, promises, and async/await.

Core Concepts at a Glance

  • Types, variables, functions, and arrow functions
  • Objects and this semantics
  • Arrays and array methods (map, filter, reduce, sort)
  • Errors, try/catch, and promises

Deep dive in the Language Refresher.

Node.js Runtime

🚀 Node.js Architecture

📝 Your JavaScript Code
🔧 Node.js APIs
fs, http, path, crypto...
V8 Engine
JS execution
libuv
Async I/O
💻 Operating System
Files, Network, Processes
Common Use Cases:
🌐 REST APIs ⚡ Real-time apps 💻 CLI tools 🔗 Microservices

Idea behind Node.js

Node.js runs JavaScript on the server using the V8 engine plus system bindings for files, network, and more. It’s great for I/O‑heavy apps.

Learn more

See the dedicated Node.js page for examples and patterns.

🚀 Ready to go deeper?

Continue to JavaScript Refresher

Strengthen your JavaScript fundamentals with modern ES6+ syntax, functions, objects, and async patterns.

📦 Variables & Types
Functions & Objects
🔄 Async & Promises
Explore JS Refresher
{ }
</>
DOM
? Shortcuts

⌨️ Keyboard Shortcuts

Next section J
Previous section K
Change language L
Toggle theme T
Scroll to top Home
Close modal Esc