node.js - 创建一个从 AZURE 读取数据的 Nodejs Web 应用。 (流分析或事件中心或日志分析)

标签 node.js azure web-applications powerbi azure-stream-analytics

我已将多个设备连接到 Azure 流分析,这些设备将发送各种数据。 (温度、光照、湿度等)

我不确定如何读取数据 Azure 资源将其显示在我在 Azure 上发布的 Web 应用程序上。例如读取device_name、设备的数据。

我需要的可能是一个示例代码,它从 Azure 读取一些数据,然后将其显示在简单的“h1”或“p”标签上。

PS:我看过很多教如何将 Web 应用程序发布到 Azure 的教程。但几乎没有任何教程专门教授如何从 Azure 资源读取和获取数据。

最佳答案

您可以使用Azure SDK for Node.js管理 Azure 资源。

这是检索有关现有事件中心的信息的示例。这是 Azure Node SDK reference .

const msRestAzure = require('ms-rest-azure');
const EventHubManagement = require('azure-arm-eventhub');

const resourceGroupName = 'testRG';
const namespaceName = 'testNS';
const eventHubName = 'testEH';
const subscriptionId = 'your-subscription-id';

msRestAzure
  .interactiveLogin()
  .then(credentials => {
    const client = new EventHubManagement(credentials, subscriptionId);
    return client.eventHubs.get(resourceGroupName, namespaceName, eventHubName);
  })
  .then(zones => console.dir(zones, { depth: null, colors: true }))
  .catch(err => console.log(err));

关于node.js - 创建一个从 AZURE 读取数据的 Nodejs Web 应用。 (流分析或事件中心或日志分析),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55113239/

相关文章:

mysql - Web 应用程序的数据库测试

javascript - 主屏幕持久性上的 iPhone WebApp

node.js - 将控制台记录到 Electron 文件中

node.js - 为 RTBkit 使用 node.js 的投标代理

azure - 如何增加azure中纪元的大小

azure - 无法发送推送通知

azure - 如何为azure linux VM上托管的nodejs应用程序设置自定义域名

mysql - 从表执行查询并根据结果执行另一个查询?

javascript - react : How to manage state for multiple input types

C# 字符串操作