Node.js
Overview
Node.js is a JavaScript runtime built on Chrome’s V8 engine, designed for event-driven, non-blocking I/O. It powers CLIs, HTTP APIs, real-time servers, and build tooling (Webpack, Vite backends). npm is the default package ecosystem.
Key concepts
- Event loop — Single-threaded JS with libuv thread pool for I/O.
- Modules — CommonJS (
require) vs ESM (import) interoperability rules. - Streams — Handle large data incrementally.
- Buffers & binary —
Buffer,Uint8Arrayinterop. - Security — Supply chain hygiene,
npm audit, lockfiles.
HTTP request handling
Sample: native HTTP server
import http from 'node:http';
const server = http.createServer((req, res) => {
if (req.url === '/api/health') {
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ ok: true }));
return;
}
res.writeHead(404);
res.end();
});
server.listen(3000);
References
- Node.js Documentation
- npm Documentation
- W3Schools — Node.js
- Express.js (popular framework)