openskills.info
Node.js Fundamentals logoCourse Preview

Node.js Fundamentals

Node.js is a runtime that executes JavaScript outside a web browser. It combines the V8 engine with operating-system APIs so programs can read files, open network connections, run command-line tools, and serve many concurrent requests.

itWeb development

Don't Panic — Node.js Fundamentals

Node.js is JavaScript with a job outside the browser: it runs as an operating-system process and brings files, network sockets, timers, streams, and process controls to the party. The language is still JavaScript. The surroundings are not. A browser document does not arrive with the luggage, which is often the first clue that the runtime has changed rooms.

The important arrangement is one main JavaScript thread taking short turns around work that is waiting elsewhere. The event loop chooses the next ready callback after the current one returns. Network activity can continue while the thread is free. That is why a Node.js server can wait on many connections without appointing a personal thread to each one, a management style that would become expensive quite quickly.

Here is the surprise: async is not a tiny forklift for calculations. It changes how a function reports its eventual result through a promise. A long calculation remains on the main thread unless the application moves it. Worker threads are the deliberate in-process option for parallel JavaScript. Child processes, containers, and external workers make different bargains about isolation and durable work.

A program begins with an entry file, loads modules, and stays around while it still owns work such as a server, socket, or timer. Node.js supports ECMAScript modules and CommonJS, which are both useful right up to the point where one file is interpreted as the other. State the module format in package.json or use the explicit extensions; mystery is rarely a productive dependency.

Data arrives through callbacks, promises, events, and streams. Streams move bytes in pieces, so a slow consumer must be allowed to slow the producer. That arrangement is called backpressure. Ignore it and memory becomes the unpaid intern carrying an ever-growing pile of chunks until it resigns.

Errors also need a named owner. A thrown exception, rejected promise, or emitted error travels by a different route. A process that reaches unknown state should end normal operation; a supervisor provides the fresh replacement. During shutdown, stop new work, allow in-flight work a deadline, close resources, and then leave without trying to write an epic sequel from a damaged process.

Read the Intro for the architecture and choices. Use Slides when the moving parts need a compact map. Keep the Cheatsheet nearby for module markers, streams, process states, and diagnosis. Then use the practice reference and exercise to make the request-response path and its test observable. The next pieces of Node.js will have somewhere sensible to attach themselves.

Where this skill leads

Relevant careers

See how this topic contributes to broader role-level skill maps.

Sources