Skip to content
Laviyx Learn

Try

Node.js and Express course menu

Introduction to Node.js: JavaScript on the Server

Learn what Node.js is and why developers use it: running JavaScript outside the browser, the V8 engine, non-blocking I/O and the event loop, what Node is good and bad at, Express, and what you will build in this course.

Beginner3 min readUpdated
On this page

Node.js runs JavaScript outside the web browser. With it, the same language that powers web pages can build web servers and APIs, command-line tools, scripts that process files, real-time chat servers, and the build tools front-end developers use every day (Vite, Next.js and npm itself run on Node).

How it works#

Node.js takes V8, the JavaScript engine from Google Chrome, and adds what a server needs that a browser does not provide: reading and writing files, networking, processes, and more. In the browser JavaScript has window and document; in Node it has modules such as fs (files), http (web servers) and process (the running program).

JavaScript
console.log("Hello from Node.js!");
console.log("2 + 3 =", 2 + 3);
console.log("Running on Node", process.version);
Output
Hello from Node.js!
2 + 3 = 5
Running on Node v24.15.0

The version line shows the Node.js release this course was run with.

Non-blocking by design#

A web server spends most of its time waiting: for the disk, a database, another API. Node handles waiting differently from many traditional servers. Instead of one thread per request sitting idle while it waits, Node starts the slow operation, carries on with other work, and runs your callback (or resumes your await) when the result is ready. This is coordinated by the event loop.

JavaScript
console.log("1. Start reading the order file");
setTimeout(() => console.log("3. File ready (finished later)"), 100);
console.log("2. Meanwhile, keep serving other users");
Output
1. Start reading the order file
2. Meanwhile, keep serving other users
3. File ready (finished later)

The program does not stop and wait at the slow step. One Node process can serve thousands of simultaneous connections this way, as long as no single task keeps the CPU busy for long. You will see how the event loop works in Asynchronous Node.

What Node is good at#

  • Web servers and REST APIs (with Express, which this course teaches);
  • real-time apps: chat, notifications, live dashboards, multiplayer games;
  • command-line tools and automation scripts;
  • full-stack JavaScript: one language for front end and back end, sharing code and types.

What it is less suited to: long, CPU-heavy computations (video encoding, large number crunching) on the main thread, because they block every other request. Those belong in worker threads, separate services, or other languages.

Express#

Express is a small, widely used web framework for Node. Node's built-in http module can serve requests, but Express adds routing, middleware and helpers that make building APIs much quicker. Most of this course uses Express on top of core Node.

What you will learn#

  1. Node basics: running scripts, modules, npm packages.
  2. Core modules: files, paths, environment variables, events, streams, the event loop and a raw HTTP server.
  3. Express: routes, middleware, validation, responses and error handling.
  4. REST APIs with a real database, project structure, authentication and security.
  5. Testing, configuration, logging and deployment, plus two complete projects.

You should already know JavaScript basics: variables, functions, arrays, objects, promises and async/await (see the JavaScript course).

Key takeaway#

Next: Installing and Running Node.js.

Finished this lesson?