Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

542
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda