我已经用尽了 Azure Function 文档,但无法弄清楚如何部署 TypeScript Azure Function 并包含 Node.js 依赖项。我正在使用 VSCode Azure Functions 工具在 Linux 服务器上部署无服务器代码。
我无法使用 Kudu 服务,因为它仅适用于 Windows Azure Functions
我尝试在 Azure Function 应用程序的根目录和文字函数文件夹本身中包含 package.json。
任何指示将不胜感激!
最佳答案
这里有一些事情。
- 使用 func 工具创建项目
func init --worker-runtime typescript
- 安装打字模块 @azure/functions - 如果未安装
- 构建项目
npm run build:production
- 如果您愿意,您甚至可以使用
func azure functionapp publish <APP_NAME>
进行发布
使用类型
import { AzureFunction, Context, HttpRequest } from "@azure/functions"
您可以查看documentation
关于node.js - 如何包含 TypeScript Azure Function 的依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59165881/