侧边栏壁纸
博主头像
996worker

祇園精舎の鐘の聲, 諸行無常の響き有り。

  • 累计撰写 201 篇文章
  • 累计创建 48 个标签
  • 累计收到 8 条评论

目 录CONTENT

文章目录

Practice for deploying Node.js on Heroku

996worker
2021-07-03 / 0 评论 / 0 点赞 / 229 阅读 / 338 字
温馨提示:
本文最后更新于 2021-07-24,若内容或图片失效,请留言反馈。部分素材来自网络,若不小心影响到您的利益,请联系我们删除。

1. In app.js:

Import Express framework
Listen to the right port.

    app.listen(process.env.PORT || 8080, () => {
    // process.env.PORT is for Heroku's port
    if (process.env.PORT) {
        console.log('port: ' + process.env.PORT);
    } else {
        console.log('port: 8080')
    }
})

2. Create a file called Procfile

inside: web: npm start

3. Publish it to github, then attach this repository to the Heroku platform. Done.

0

评论区