Skip to content
Snippets Groups Projects
Commit 3140ce42 authored by Gunananthaa K B's avatar Gunananthaa K B
Browse files

basic working proxy

parent 8853e8a9
Branches
No related tags found
No related merge requests found
......@@ -5,8 +5,13 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Web Serving content</title>
<style>
#top-head{
text-align: center;
}
</style>
</head>
<body>
<h1 id="top-head">Web content served by the Proxy!</h1>
</body>
</html>
\ No newline at end of file
const http = require('http');
const fs = require('fs').promises;
const PORT = 3000;
const requestListener = (req,res)=>{
fs.readFile('./contents/index.html').then(contents=>{
res.setHeader("Content-Type", "text/html");
res.writeHead(200);
res.end(contents);
});
console.log(req.headers);
res.end("hello");
}
const server = http.createServer(requestListener);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment