I'm new to nodejs, All I'm trying to do is running a simple nodejs file on windows console Here's what I'm doing :
const http = require('http');
const host = '127.0.0.1';
const port = 3000;
const server = http.createServer(function(request, response) {
response.writeHead(200, {
'Content-Type': 'text/html'
});
response.end('Hello world');
}).listen(port, host);
server.on('connect', function(req) {
console.log(req.url);
console.log('Connected!');
})
server.on('error', function(e) {
console.log(e);
})
The file is stored on D:\nodjs\test directory when I navigate to this directory and run
the node hello.js command I'm expecting to see outputs ( response ) on the console.
However this is not happening, it just show a blank response, I wonder if it takes too long to load or anything else might be related with my client/port setup ?