【发布时间】:2021-03-26 09:58:48
【问题描述】:
我需要监听 azure cosmos db 的变化,然后根据收到的信息对另一个 api 进行 POST 调用。
我添加了这个function.json
{
"bindings": [
{
"type": "cosmosDBTrigger",
"name": "input",
"direction": "in",
"leaseCollectionName": "leases",
"connectionStringSetting": "validAppsTrigger2_ConnectionString",
"databaseName": "dev",
"collectionName": "validApps",
"createLeaseCollectionIfNotExists": true
},
{
"name": "response",
"direction": "out",
"type": "http"
}
]
}
这是我的 index.js
module.exports = function (context, input) {
context.log('Document Id: ', input[0].id);
// should I call http manually here?
context.done();
};
但我不确定我应该如何从那里调用另一个 azure http 函数,
- 我需要
out绑定吗? - 我应该只在上述函数中进行常规 http 调用吗?
【问题讨论】:
-
只需向其他函数端点发出 http 请求
-
@ThiagoCustodio 是否意味着我不需要
out绑定,对吗? -
正确,只是一个普通的http请求
标签: node.js azure azure-functions azure-cosmosdb