Application Error when attempting to deploy Node.js/Express/Socket.io application on Heroku

后端 未结 5 725
甜味超标
甜味超标 2021-02-03 11:19

I am fairly new to all of these technologies (including somewhat JavaScript) so you might have to bear with me here.

I followed the ChatApp tutorial over at Socket.IO do

5条回答
  •  耶瑟儿~
    2021-02-03 11:19

    Disclosure: I'm the Node Platform Owner at Heroku

    First, you should run heroku logs to get logging output.

    Second, do you mean to have commented out listen on your server? Without this, your server won't allow any incoming connections:

    // http.listen(3000, function(){ // console.log('listening on *:3000'); // });

    Finally, instead of binding to a hardcoded port (3000), you should bind to an environment variable with a default:

    http.listen(process.env.PORT || 3000, function(){ console.log('listening on', http.address().port); });

提交回复
热议问题