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();
考虑样本