// Importing the HTTP module
const http = require('http');
// Creating a server using the HTTP module's createServer method
const server = http.createServer((req, res) => {
// Setting the response header with a status code of 200 and content type as text/plain
res.writeHead(200, {'Content-Type': 'text/plain'});
// Sending the response with the text 'Hello, World!'
res.end('Hello, World!\n');
});
// Listening to port 8080 for incoming requests
server.listen(8080, () => {
// Once the server is running, logging a message to the console
console.log('Server running at http://127.0.0.1:8080/');
});