Sequence NODE_221
Easy

Create a Basic HTTP Server (No Express)

Node.js
Technical Specification

Create a basic HTTP server using Node's built-in http module that responds with plain text.

Input/Output Samples
Input:GET /
Output:Hello from Node server
Optimal Logic Path
const http = require("http");

const server = http.createServer((req, res) => {
  res.writeHead(200, { "Content-Type": "text/plain" });
  res.end("Hello from Node server");
});

server.listen(3000, () => {
  console.log("Server running on http://localhost:3000");
});
Architectural Deep-Dive
We use the core http module to accept requests and send back a plain text response.