【发布时间】:2021-09-10 14:03:18
【问题描述】:
尝试在 Azure Function NodeJs 项目中查找可以保存请求/响应级别变量的对象。
类似于 expressjs 中的 res.locals http://expressjs.com/en/5x/api.html#res.locals
请建议是否有任何其他方式可以让我使用 azure 函数在每次执行时使用局部变量。
【问题讨论】:
标签: node.js azure express azure-functions
尝试在 Azure Function NodeJs 项目中查找可以保存请求/响应级别变量的对象。
类似于 expressjs 中的 res.locals http://expressjs.com/en/5x/api.html#res.locals
请建议是否有任何其他方式可以让我使用 azure 函数在每次执行时使用局部变量。
【问题讨论】:
标签: node.js azure express azure-functions
谢谢Cloud SME。发布您的建议作为帮助其他社区成员的答案。
如果您在函数应用的根目录中使用local.settings.json 文件:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "",
"FUNCTIONS_WORKER_RUNTIME": "node",
"translatorTextEndPoint": "https://api.cognitive.microsofttranslator.com/",
"translatorTextKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"languageWorkers__node__arguments": "--prof"
}
}
您可以参考Azure Functions JavaScript Local Development Environment Variables、Azure Functions JavaScript local development environment和Deploy Azure Funtions with Environment variables - Nodejs
【讨论】: