Nodejs in the Azure

Asked

Viewed 46 times

1

I did a simple public project on API Nodejs. https://github.com/andreraica/NodeAPI

However when publishing and accessing the API in AZURE did not answer: ERR_CONNECTION_TIMED_OUT

Running site works perfectly. Localhost

I did all the possible publishing procedures and the GIT Build shows everything ok through the Azure portal.

Does anyone have any suggestions?

  • Take a look at the directory structure in the Webapp. Have you made sure that the Webapp is waiting for a Nodejs application? What version of the Webapp are you using? Webapp or Webapp on Linux?

1 answer

1

I managed to solve. Need to use door environment variable (process.env.PORT), as below.


Wrong code:

app.listen(3000, function(){
  console.log('Servidor rodando na porta. server<<' + process.env.PORT + '>> ou local<<3000>>');
});

Corrected code:

app.listen(process.env.PORT || 3000, function(){
  console.log('Servidor rodando na porta. server<<' + process.env.PORT + '>> ou local<<3000>>');
});

Thanks for the force

Browser other questions tagged

You are not signed in. Login or sign up in order to post.