I have a issue with publishing sns to a specific endpoint.
我的代码:
var AWS = require('aws-sdk');
AWS.config.loadFromPath('/web/config.json');
var sns = new AWS.SNS();
sns.publish({
// TopicArn:'arn:aws:sns:us-west-2:302467918846:MyTestTopik',
TargetArn: 'arn:aws:sns:us-west-2:302467918846:MyTestTopik:613ee49c-d4dc-4354-a7e6-c1d9d8277c56',
Message: "Success!!! ",
Subject: "TestSNS"
}, function(err, data) {
if (err) {
console.log("Error sending a message " + err);
} else {
console.log("Sent message: " + data.MessageId);
}
});
Run Code Online (Sandbox Code Playgroud)
当我使用时TopicArn,一切都很好.但是当我尝试向特定端点发送通知时,我会收到错误:
发送消息时出错InvalidParameter:参数无效:主题名称
我不知道它是什么样的参数,从哪里来.
我想处理这样的HTTP请求:
GET http://1.2.3.4/status?userID=1234
Run Code Online (Sandbox Code Playgroud)
但我无法从中提取参数userID.我正在使用Express,但它并没有帮助我.例如,当我写下面的内容时,它不起作用:
app.get('/status?userID=1234', function(req, res) {
// ...
})
Run Code Online (Sandbox Code Playgroud)
我希望有可能1234为任何本地参数获取值,例如,user=userID.我怎样才能做到这一点?