Quantcast
Channel: Node.jsタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 9309

Cloud Foundryでのlocalhostとportの設定

$
0
0

Cloud FoundryでのDeployで、localhostとportの設定を行う

今回はexpressのアプリを例にやります。
CFでは環境変数のVCAP_APP_HOSTとVCAP_APP_PORTをそれぞれ用います。
存在しない場合の設定も加えます。

server/index.js
...constHOST=process.env.VCAP_APP_HOST||'localhost'constPORT=process.env.VCAP_APP_PORT||3000app.listen(PORT,HOST)...

以上です。


Viewing all articles
Browse latest Browse all 9309

Trending Articles