Node.js is an open-source server-side platform built on Chrome's V8 JavaScript engine. It allows developers to run JavaScript outside of a browser, making it ideal for building scalable network applications.

Getting Started ✅

  1. Install Node.js
    Download from nodejs.org and follow the installation guide for your OS.
  2. Verify Installation
    Open terminal and run:
    node -v
    npm -v
    
    📌 Expected output: version numbers for Node.js and npm.

Core Concepts 🧠

  • Event Loop: Handles asynchronous operations (⏰)
  • Non-blocking I/O: Efficient handling of multiple requests (🔄)
  • Modules: Reusable code components (📦)
  • npm: Package manager for JavaScript (📦)

Simple Example 🧪

Create a file hello.js with:

const http = require('http');

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

console.log('Server running at http://127.0.0.1:3000/');

Expand Your Knowledge 🚀

nodejs_logo
nodejs_architecture