javascript - Node.js closes as I open it -


i running simple script in nodejs, loading static html file.

var http = require("http"); fs = require('fs');  fs.readfile('./index.html', function (err, html) {     if (err) {         throw err;      }        });  http.createserver(function(request, response) { response.writehead(200, {"content-type": "text/plain"}); response.write("hello world"); response.end(); }).listen(1994); 

whenever launch application closes. see text on console half second application launches, window closes. happens every time.

you using node.js repl comes installation of node.js.

i no errors when run code (assuming have index.html in directory , no error thrown).

try run code via command line commandnode yourscriptfilename.js


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -