I got a bit of help so I have some code to work with, but I can't seem to figure this out so, I'm looking for some more help. The task I'm working on is displaying html files as links on a local webpage, and updating this automatically as there will be a new folder(inserted into the same root folder) with a new file every day.
My problem is accessing the folders and selecting the html file which is always called main.html. The folders have a different name since it has a date in the name, but the html file is always called main.html. I want to update the page daily. Im using node and javascript. 
I have tried to find online tutorials, but they always just read the files, and do not display files as links or update them regularly.
    var http = require("http");
    var fs = require("fs");
    var server = http.createServer(function(req, res) {
    res.writeHead(200, { "Content-Type": "text/html" });
    var myReadStream = fs.createReadStream(__dirname + "/index.html", "utf8");
    myReadStream.pipe(res);
    });
    server.listen(3000, "127.0.0.1");
    const spawn = require("child_process").spawn;
    const resolve = require("path").resolve;
    const dir = _resolve(
      require("os").homedir(),
      "(Filepath for folder that gets inserted into the folder everyday)"
    );
    function getFiles(dir, ...flags) {
      const child = spawn("ls", flags);
      return new Promise((resolve, reject) => {
        let data = "";
        child.stdout.on("data", chunk => (data += chunk.toString()));
        child.stdout.on("err", err => reject(err.toString()));
        child.stdout.on("end", () => resolve(data));
      });
    }
    function monitorFileChanges(dir) {
      watch(dir, (event, filename) => {
        console.log(event, filename);
      });
    }
    //Logging out and monitoring files in current directory
    console.log(`current directory: ${dir}`);
    monitorFileChanges(dir);
    getFiles(dir)
      .then(console.log)
      .catch(console.log);
