NodeJS no Azure

1

I made a simple public project in NodeJS API. link

However, publishing and accessing the API on AZURE did not respond: ERR_CONNECTION_TIMED_OUT

Running place works perfectly.

I've done all the possible publishing procedures and the GIT Build presents everything ok through the Azure portal.

Does anyone have any suggestions?

    
asked by anonymous 03.02.2017 / 16:49

1 answer

1

I managed to solve it. You need to use the variable port environment ( 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 strength

    
21.02.2017 / 13:28