【问题标题】:Get the route info within the express app in bluemix在 bluemix 中获取 express 应用程序中的路线信息
【发布时间】:2016-02-11 11:58:22
【问题描述】:

我希望能够在我的应用程序中获取 Bluemix 路由信息?我试过 VCAP_APP_HOST 但它返回 0.0.0.0

【问题讨论】:

  • 为什么需要应用程序的路由? Express 只需要知道要运行的端口即可。下面的示例: var port = process.env.VCAP_APP_PORT || 3000; app.listen(端口); console.log('监听:', 端口);

标签: express routes ibm-cloud hostname


【解决方案1】:

我建议使用 NPM 的 cfenv 包,它可以方便地公开环境信息以及其他有用的信息。 getAppEnv 方法将返回您正在查找的信息。 See documentation here.

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-05-02
    • 1970-01-01
    • 1970-01-01
    • 2016-07-22
    • 1970-01-01
    • 2016-09-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多