我正在使用 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/