最新消息: 电脑我帮您提供丰富的电脑知识,编程学习,软件下载,win7系统下载。

AWS LAMBDA HTTP POST请求(Node.js的)

IT培训 admin 9浏览 0评论

AWS LAMBDA HTTP POST请求(Node.js的)

我是比较新的AWS lambda表达式和的NodeJS。我正在使用本网站的HTTP POST请求,试图让一个国家的5个城市的名单:“.asmx?op=GetCitiesByCountry”

我一直在寻找如何做拉姆达功能的HTTP POST请求,但我似乎无法找到它一个很好的解释。

搜索,我发现了HTTP POST:

How to make an HTTP POST request in node.js?

回答如下:

尝试下面的示例,调用HTTP GET或在从AWS拉姆达的NodeJS POST请求

const options = {
        hostname: 'hostname',
        port: port number,
        path: urlpath,
        method: 'method type'
    };

const req = https.request(options, (res) => {
    res.setEncoding('utf8');
    res.on('data', (chunk) => {
      // code to execute
    });
    res.on('end', () => {
      // code to execute      
    });
});
req.on('error', (e) => {
    callback(null, "Error has occured");
});
req.end();

考虑样本

AWS LAMBDA HTTP POST请求(Node.js的)

我是比较新的AWS lambda表达式和的NodeJS。我正在使用本网站的HTTP POST请求,试图让一个国家的5个城市的名单:“.asmx?op=GetCitiesByCountry”

我一直在寻找如何做拉姆达功能的HTTP POST请求,但我似乎无法找到它一个很好的解释。

搜索,我发现了HTTP POST:

How to make an HTTP POST request in node.js?

回答如下:

尝试下面的示例,调用HTTP GET或在从AWS拉姆达的NodeJS POST请求

const options = {
        hostname: 'hostname',
        port: port number,
        path: urlpath,
        method: 'method type'
    };

const req = https.request(options, (res) => {
    res.setEncoding('utf8');
    res.on('data', (chunk) => {
      // code to execute
    });
    res.on('end', () => {
      // code to execute      
    });
});
req.on('error', (e) => {
    callback(null, "Error has occured");
});
req.end();

考虑样本

发布评论

评论列表 (0)

  1. 暂无评论