This website can not be accessed

0

I am learning node.js and this next instruction is presented to me; nevertheless when executing it through node filename.js I get " Unable to access this WEB site" , I appreciate any guidance.

var http=require("http");
var fs=require("fs");

http.createServer(function (req,res) {
    fs.readFile("./index.html",function(err,html){
        res.writeHead(200,{"Content-Type":"text/html"});
        res.write(JSON.stringify({nombre:"Uriel",username:"uriel"}));
        res.end();
    }).listen(8000);
  });
    
asked by kordero 21.03.2018 в 23:32
source

0 answers