Description #
Node.js is a JavaScript runtime environment that lets developers run JavaScript code outside the browser. It’s built on Chrome’s V8 engine and enables the creation of fast, scalable network applications—especially back-end APIs and real-time tools.
History #
Node.js was created by Ryan Dahl in 2009 to solve the blocking nature of web servers like Apache. It introduced an event-driven, non-blocking I/O model using JavaScript—revolutionizing server-side development.
Key milestones:
- 2009: Node.js is first released
- 2011–2014: npm gains massive traction as Node’s package manager
- 2015: Node.js merges with io.js and becomes part of the OpenJS Foundation
- 2020+: Modern updates bring improved support for ES modules, async/await, and performance boosts
Hello World Code #
// hello.js
const http = require('http');
const server = http.createServer((req, res) => {
res.end('Hello, World!');
});
server.listen(3000, () => {
console.log('Server running on http://localhost:3000');
});
How to Run #
Locally: #
- Install Node.js from https://nodejs.org/
- Save the code above as
hello.js
- Run in terminal:
node hello.js
- Visit
http://localhost:3000
in your browser
Online: #
Use any of these platforms to test:
Key Concepts #
- Non-blocking I/O — handles many requests simultaneously
- Single-threaded event loop — avoids the need for multiple threads
- Built-in modules — like
http
,fs
,path
, andevents
- npm (Node Package Manager) — massive ecosystem of packages
- CommonJS modules — require-based file structure
- ES Modules — now fully supported via
import/export
- Express.js — most popular framework built on Node.js
- Real-time capabilities — perfect for chat apps and sockets
- Environment variables — manage via
.env
files - Cross-platform — works on macOS, Linux, and Windows
Try It Online #
🔗 Replit Node.js Template
🔗 Glitch Starter App
🔗 CodeSandbox Node Environment
Fun Facts #
- Node.js is used by Netflix, PayPal, LinkedIn, and Uber
- Over 1.5 million packages are available on npm
- Creator Ryan Dahl later created a Node competitor, Deno
- Node.js is a favorite for full-stack JavaScript development
- It’s one of the few runtimes designed around asynchronous-first architecture