业务逻辑nodejs节点如何使用云端api

1.新建一个服务流如图所示#
业务逻辑nodejs节点如何使用云端api
2.nodejs配置 #

完整的节点代码
module.exports = async function(payload, node, query, context, global) {

const Core = require('@alicloud/pop-core');

    var client = new Core({
      accessKeyId: 'LTAI4FyhxT4Z4WQQvSyfFAKJ',
      accessKeySecret: 'jdjP6MDjZkQztyjDMSyhoitZ1dxR8d',
      endpoint: 'https://iot.cn-shanghai.aliyuncs.com',
      apiVersion: '2018-01-20'
    });
    

    var params = {
      "RegionId": "cn-shanghai",
      "CurrentPage": 1,
      "PageSize": 10
    }
    
    var requestOption = {
      method: 'POST'
    };
     var response="";
    await client.request('QueryProductList', params, requestOption).then((result) => {
      console.log(JSON.stringify(result));
      response = result;
    }, (ex) => {
      console.log(ex);
    })
           
    return response;

}

保存部署测试

业务逻辑nodejs节点如何使用云端api

上一篇:web时间范围组件和业务逻辑的交互


下一篇:nodejs节点使用redis