const http = require("http");

const fs = require("fs");
var data = fs.readFileSync("main.html");
http
  .createServer((req, res) => {
    if (req.url == "/home") {
      res.write(data.toString());
      res.end();
    } else if (req.url == "/") {
      res.write("<h1>Hello World</h1>" + req.url);
      res.end();
    } else if (req.url == "/about") {
      res.write("<h1>Hello About</h1>" + req.url);
      res.end();
    } else {
      res.write("<h1>404</h1>" + req.url);
      res.end();
    }
  })
  .listen(5000);