Created
August 11, 2022 07:41
-
-
Save prankush-tech/62c545e2da1a7f750801450fa65c8e62 to your computer and use it in GitHub Desktop.
Revisions
-
prankush-tech created this gist
Aug 11, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>HOME PAGE</title> </head> <body> <div class="homepage"> <h1 class="text">THIS IS A HOME PAGE</h1> </div> <div class="list"> <ui> <li>About</li> <li>Services</li> <li>Contact me</li> <li>home</li> </ui> </div> </body> </html> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,43 @@ const http = require('http'); const port = 2000 hostname= "localhost" const fs = require('fs') const home = fs.readFileSync("./index.html", "utf8") const server = http.createServer((req,res)=>{ if(req.url === "/") { return res.end(home) } if(req.url === "/about") { return res.end("<h1>About Page</h1>") } if(req.url === "/contact") { return res.end("<h1>contact Page</h1>") } if(req.url === "/services") { return res.end("<h1>services Page</h1>") } if(req.url === "/help") { return res.end("<h1>help Page</h1>") } else { return res.end("<h1>404 JIHAD OCCURED</h1>") } }) server.listen(port,"localhost",()=> { console.log(`Server is listening on port http://${hostname}:${port}`) })