Ffile serve in node js

technical talkiess
0

 

Files serve :- 


var http = require('http')

var fs = require('fs')


var content1 = fs.readFileSync('test.txt')


var server = http.createServer((req,content)=>{

    content.writeHead(200,{'Content-type':'text/html'});

    content.end(content1)

});


server.listen(80,'127.0.0.1',()=>{

  console.log("This is the test site");

})


Tags

Post a Comment

0Comments

Thanks you for commenting your questions. I will see question and respond you.

Post a Comment (0)