2017-08-16 72 views
0

我在向Heroku部署應用程序時遇到問題。當我的服務器啓動時,它立即崩潰,沒有錯誤信息,所以我沒有什麼可以關閉的。我正在使用Hapi,並且本地一切正常。將節點應用程序部署到Heroku

這是我的src/index.js:

const Hapi = require('hapi') 
const routes = require('./routes') 

const server = new Hapi.Server() 
const connectionOptions = { 
    host: process.env.HOST_NAME, 
    port: process.env.PORT || 8080 
} 

server.connection(connectionOptions) 
console.log('SERVER CONNECTION') 
routes({ server }) 

這些都是Heroku的日誌:

2017-08-16T20:23:55.716723+00:00 app[web.1]: > node ./src/index.js 
2017-08-16T20:23:56.714915+00:00 app[web.1]: Server started at: http://hashtag-news-api-dev.herokuapp.com:45709 
2017-08-16T20:23:56.677341+00:00 app[web.1]: SERVER CONNECTION 
2017-08-16T20:23:56.809918+00:00 heroku[web.1]: Process exited with status 0 
2017-08-16T20:23:56.816328+00:00 heroku[web.1]: State changed from starting to crashed 

我缺少的東西?我認爲我已經準備好了一切,以便繼續Heroku

回答

0

設置HOST_NAME'0.0.0.0'工作。

相關問題