Setting the port for node.js server on Heroku

前端 未结 6 1518
醉梦人生
醉梦人生 2020-11-30 09:51

I launched a node.js server with the following line to set the port:

app.set(\'port\', process.env.PORT || 8080);

This means that, it shoul

6条回答
  •  盖世英雄少女心
    2020-11-30 10:15

    You should use the port opened by heroku like so:

    port = process.env.PORT || 80
    

    It sets the port to 80 if it has somehow not been set already

提交回复
热议问题