kjromero

node

May 22nd, 2016
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. var http = require("http");
  2. fs = require("fs");
  3.  
  4. var name;
  5.  
  6. var html = fs.readFileSync("./index.html", (err, data) => {
  7. if (err) throw err;
  8. name = data;
  9. });
  10.  
  11. http.createServer(function(rep,res){
  12. res.write(html);
  13. console.log("read file", name,"sussesfull");
  14. res.end();
  15. }).listen(8080);
Add Comment
Please, Sign In to add comment