// Step 1: Import the 'http' module
const http = require('http');
// Step 2: Create an HTTP server that responds with 'Hello, World!' for all requests
const server = http.createServer((req, res) => {
// Step 3: Set the response header with a status code of 200 and content type of plain text
res.writeHead(200, {'Content-Type': 'text/plain'});
// Step 4: Send the 'Hello, World!' message as the response body
res.end('Hello, World!\n');
});
// Step 5: Listen on port 3000 and IP address 127.0.0.1
server.listen(3000, '127.0.0.1', () => {
// Step 6: Log a message when the server is successfully listening
console.log('Server listening on port 3000');
});