const http = require("http");
const port = 3000;

// Handles GET request to main page
const server = http.createServer(function (req, res) {   
   if (req.method === "GET" && req.url === "/") {
      res.writeHead(200, { "Content-Type": "text/plain" });
      res.end("I received your request!");
   } else {
      res.writeHead(404);
      res.end("Not Found");
   }
});

server.listen(port);
console.log(`Server listening at http://localhost:${port}`);