Cannot see console output

I just install the Webstorm, and download the node.js, but I cannot see the console output 

at least it should show server is noe running, right?

0
1 comment

You don't pass any file to node.js. Please choose your test1.js as Javascript file: in your run configuration.

But your code won't work anyway, you need to move http.createServer() call out of onRequest():

var http = require('http');

function onRequest(req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.write('Hello!!!');
res.end();

}

http.createServer(onRequest).listen(8888, '127.0.0.1');
console.log('Server running at http://127.0.0.1:' + 8888);
0

Please sign in to leave a comment.