Node.js is a free, open-source JavaScript runtime built on Chrome's V8 engine, letting JavaScript run outside the browser on servers, desktops, and CLI tools. It's maintained by the OpenJS Foundation and is the single most-used web technology in the world today, reported in roughly 48.7% of developer surveys. Its non-blocking, event-driven I/O model made it the foundation of the entire modern JavaScript backend ecosystem โ npm, Express, and countless frameworks all run on top of it.
Node's built-in http module is enough to stand up a working web server with no external dependencies.
const http = require('http');
const server = http.createServer((req, res) => {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('Hello from Node.js!');
});
server.listen(3000, () => {
console.log('Server running at http://localhost:3000');
});
Install Node from nodejs.org (or a version manager like nvm), then run any script directly with the node command.
# check your installed version
node -v
# initialize a new project with a package.json
npm init -y
# run a script
node server.js