Creating a Simple Web Server

Using the HTTP Module

const http = require("http");
const server = http.createServer((req, res) => {
  res.writeHead(200, { "Content-Type": "text/plain" });
  res.end("Hello, World!");
});
server.listen(3000, () => {
  console.log("Server running at http://localhost:3000");
});

Run the server and visit http://localhost:3000 in your browser.