Topics Node.js Fundamentals Introduction to Node.js
beginner 14 min read

Introduction to Node.js

What is Node.js, its architecture, and why it is popular for backend development.

What is Node.js?

Node.js is an open-source, cross-platform JavaScript runtime environment built on Chrome's V8 JavaScript engine. It allows you to run JavaScript on the server side, outside of a browser.

Key Features

  • Event-Driven: Node.js uses an event-driven, non-blocking architecture
  • Asynchronous: I/O operations never block the execution thread
  • Single-Threaded: Uses a single thread with event looping for high concurrency
  • NPM: The largest ecosystem of open-source libraries

Node.js Architecture

// Node.js runs on the V8 engine (same as Chrome)
// libuv provides the event loop and async I/O
// Process global represents the running Node process

console.log("Node.js version:", process.version);
console.log("Platform:", process.platform);
console.log("Architecture:", process.arch);

Examples

// Hello World in Node.js
const http = require('http');

const server = http.createServer((req, res) => {
  res.writeHead(200, { 'Content-Type': 'text/plain' });
  res.end('Hello, Node.js!\n');
});

server.listen(3000, () => {
  console.log('Server running at http://localhost:3000/');
});

Your Notes

Sign in to take notes for this lesson.

Discussion

Sign in to join the discussion.

Flashcards

Sign in to create flashcards.