由于我是新手节点js没有得到如何保存来自DyanmoDB的多个数据并将其发送到另一个SERVER,我正在尝试这样,请帮我一些逻辑.... 'use strict';
var http = require('http');
console.log('Loading function');
exports.handler = (event, context, callback) => {
//event.forEach(function(event){
console.log('Received event:', JSON.stringify(event, null, 2));
var value1 = event.key1;
console.log(value1);
var headers = {
"Copntent-Type" : 'application/JSON'
};
var options = {
url : "http://www.example.com/syncData.php",
method : "POST",
headers : headers,
body : data
};
request(options, function(error, response, body){
console.log("Sending");
postData(value1, end, end+1000);
});
给出错误:
{ “errorMessage”:“RequestId:61712ab7-d956-11e6-be00-bd64296711ef在完成请求之前退出流程” }
答案 0 :(得分:0)
确保让服务器监听端口,否则它将结束其进程。
http.createServer(YOUR_APP_GOES_HERE)
.listen(PORT)