Node Home
Node.js is a free, open source tool that lets you run JavaScript outside the web browser.
With Node.js, you can build fast and scalable applications like web servers, APIs, tools, and more.
Tip: Sign in to track your progress.
Node.js uses an event-driven, non-blocking model. It can handle many connections at once without waiting for one to finish before starting another. This makes it great for real-time apps and high-traffic websites.
- Web servers and websites
- REST APIs
- Real-time apps (like chat)
- Command-line tools
- Working with files and databases
- IoT and hardware control
Save your code in a file, for example app.js, then run it in your terminal or command prompt with:
node app.js
This will start your Node.js program.
let http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World!');
}).listen(8080);
Run this code with node app.js and visit http://localhost:8080 to see "Hello World!"
npm is the package manager for Node.js. It helps you install and manage third-party packages (libraries) to add more features to your apps.
Example: Installing a package
npm install express
Using Express in your code:
const express = require('express');
const app = express();
app.get('/', (req, res) => res.send('Hello World!'));
app.listen(8080);
Download Node.js from the official website: https://nodejs.org