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

mod in static file

parent 6e6f6586
Branches master
No related tags found
No related merge requests found
......@@ -25,8 +25,9 @@ const requestListener = (req,res)=>{
if(filter(req)){
const get = http.get(options,response=>{
console.log(`statusCode: ${response.statusCode}`);
// console.log(`statusCode: ${response.statusCode}`);
if(response.statusCode===304){
console.log("Serving this request from Cache.");
res.setHeader("Content-Type", "text/html");
res.writeHead(200);
res.end(cache);
......@@ -34,6 +35,7 @@ const requestListener = (req,res)=>{
else{
let buffer="";
// console.log(`Last modified: ${JSON.stringify(response.headers['last-modified'] )}`);
console.log("Content seems modified. Serving new and storing in cache");
lastModified = new Date(JSON.parse(response.headers['last-modified']));
console.log(`Last modified; ${lastModified}`);
response.on('data',d=>{buffer+=d});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment