如何使用HTTP触发器在Azure功能应用程序中解析多部分表单数据? (的NodeJS) [英] How to parse Multi-part form data in an Azure Function App with HTTP Trigger? (NodeJS)

查看:192
本文介绍了如何使用HTTP触发器在Azure功能应用程序中解析多部分表单数据? (的NodeJS)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Azure Functions编写NodeJS HTTP端点。

I want to write a NodeJS HTTP endpoint using Azure Functions.

此端点将是一个POST端点,它接收文件并将这些文件上传到blob存储。

This endpoint will be a POST endpoint which takes files and upload these to blob storage.

然而,NodeJS多部分表单数据解析器都是httpserver或expressJS中间件的形式。

However, NodeJS multipart form data parsers are all in the form of httpserver or expressJS middleware.

是否有可用的工具在从函数应用程序的包装器收到所有数据后,它可以解析多部分表单数据吗?

Is there any available tools that can parse the multipart form data after it has all been received from the Function Application's wrapper?

谢谢!

推荐答案

由于Azure Functions已在Node.js中包装了http服务器对象,并公开了一个简单的 req 上下文具有多种功能,请参阅 https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-node#exporting-a-function 了解详情。

As Azure Functions has wrapped http server object in Node.js, and exposes a simple req and context with several functionalities, refer to https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-node#exporting-a-function for details.

大多数情况下,Azure Functions是专为触发器和webhooks请求而设计,您可以参考 https://docs.microsoft.com/en-us/azure/azure-functions/functions-compare-logic-apps-ms-flow-webjobs 进行详细比较。

And mostly, Azure Functions is designed for triggers and webhooks requests, you can refer to https://docs.microsoft.com/en-us/azure/azure-functions/functions-compare-logic-apps-ms-flow-webjobs for the detailed comparison.

同时,您可以尝试图像上传到node.js中的服务器而不使用express 将请求正文内容解析为文件内容,并上传到Azure存储利用Azure存储SDK for node.js,你可以通过KUDU控制台安装自定义节点模块。请参阅 https ://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-node#node-version--package-management 了解更多信息。

Meanwhile, you can try the answer of Image upload to server in node.js without using express to parse the request body content to file content, and upload to Azure Storage leveraging Azure Storage SDK for node.js, you can install custom node modules via KUDU console. Refer to https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-node#node-version--package-management for more info.

我建议你可以尝试利用 Azure API应用程序,以接近您的requiremnet。因为它是一个基于expressjs的项目,它将更容易处理上传文件。

And I suggest you can try to leverage Azure API App in node.js to approach your requiremnet. As it is an expressjs based project, which will be more easier to handle upload files.

任何进一步的关注,请随时告诉我。

Any further concern, please feel free to let me know.

这篇关于如何使用HTTP触发器在Azure功能应用程序中解析多部分表单数据? (的NodeJS)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆