Preview:
first npm init
second npm i express nodemon


const http = require("http");
const fs = require("fs");

const home = fs.readFileSync("./index.html", "utf-8");
const server = http.createServer((req, res) =>{
    if(req.url === "/"){
     return   res.end(home);
    }
   
});

const PORT = 4000;
const hostname = "localhost";

server.listen(PORT, hostname, () =>{
    console.log("Server is working");
});
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter