Node.js is a runtime environment that allows you to execute JavaScript outside the browser.
It uses:
🌐 Create a Basic HTTP Server:
const http = require("http");
const server = http.createServer((req, res) => {
if (req.url === "/") {
res.write("Home Page");
} else if (req.url === "/about") {
res.write("About Page");
} else {
res.write("404 Not Found");
}
res.end();
});
server.listen(3000, () => {
console.log("Server running on http://localhost:3000");
});
Node.js is a powerful tool that allows you to build backend systems using JavaScript.