Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

541
Views
Nodejs fails to show output on the cmd

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 ?

Here's a screenshot showing the case

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!