javascript - Azure 应用服务中的 process.env.NODE_ENV 在哪里

标签 javascript node.js azure express azure-web-app-service

我正在使用 ExpressJS 连接 NodeJS 和我的 Angular 应用程序之间的点。我想安装这个 npm 包 norobot :利用 process 对象。

我想知道在 Microsoft Azure 内的应用服务中在何处/如何设置 NODE_ENV

我被指到了这里, https://learn.microsoft.com/en-us/azure/app-service/web-sites-configure#howtochangeconfig

但是当前的 Azure 门户看起来与文档提供的内容明显不同,导致我产生了很大的脱节。

如果您能指出正确的方向,我将不胜感激。

额外仅供引用, 在运行时,我的堆栈在 Node.js 9.4 上运行。

最佳答案

I wanted to install this npm package norobot: to leverage the process object.

norobot 包与 process 完全无关.

But the current-day Azure portal looks significantly different versus what the documentation has supplied, leading me to a big disconnect.

外观(在某种程度上)确实不重要,它们充当视觉指南。

您发布的指南/文档的关键部分是 App Settings :

This section contains name/value pairs that your web app will load on start up.

  • PHP, Python, Java and Node applications can access these settings as environment variables at runtime. For each app setting, two environment variables are created; one with the name specified by the app setting entry, and another with a prefix of APPSETTING_. Both contain the same value.

因此遵循类似的答案:https://stackoverflow.com/a/34622196/2382650

set: NODE_ENV: some_value 如上所示,它将在您的 Express 应用程序中作为 process.env.NODE_ENV

使用>

关于javascript - Azure 应用服务中的 process.env.NODE_ENV 在哪里,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51503928/

相关文章:

html - 合并 angular2 模板时 html 中的 EOF 字符?

python - 将文件上传到 Blob 存储上的 Azure 容器时排除子文件夹

c# - 如何使用 app.config 将 Azure Key Vault 连接到 C# Windows 服务

javascript - Robotjs无法在Electron和Windows 10上使用

javascript - knockout 从输入到函数的发送值

node.js - 跨多个服务器持久化websocket连接对象

javascript - 如何在S3存储桶中存储图像?

.net - 如何检查azure资源是否可用(向上/向下)

javascript - 从 Angular 调用.net core方法会出现错误: failed to load resource: the server responded with a status of 404 ()

javascript - 如何将字符串参数从 Angular UI 传递到 node.js 后端?