AWS Lambda 関数のリクエスト

AWS Lambda 関数のリクエスト:


AWS Lambda 関数の呼び出し方法

AWS ドキュメント参照
https://docs.aws.amazon.com/ja_jp/lambda/latest/dg/invoking-lambda-functions.html

AWS Lambda 関数のリクエスト

var xhr = new XMLHttpRequest(); 
xhr.open('GET','https://ganyf52nbe.execute-api.ap-northeast-1.amazonaws.com/dev/compare-yourself/all'); 
xhr.onreadystatechange = function(event) { 
  console.log(event.target.response); 
}  
xhr.setRequestHeader('Content-Type', 'application/json'); 
xhr.send(); 


> 結果 OK chrome で表示される


all のケース

var xhr = new XMLHttpRequest(); 
xhr.open('GET','https://ganyf52nbe.execute-api.ap-northeast-1.amazonaws.com/dev/compare-yourself/all'); 
xhr.onreadystatechange = function(event) { 
  console.log(JSON.parse(event.target.response)); 
}  
xhr.setRequestHeader('Content-Type', 'application/json'); 
xhr.send(); 


single のケース

var xhr = new XMLHttpRequest(); 
xhr.open('GET','https://ganyf52nbe.execute-api.ap-northeast-1.amazonaws.com/dev/compare-yourself/single'); 
xhr.onreadystatechange = function(event) { 
  console.log(JSON.parse(event.target.response)); 
}  
xhr.setRequestHeader('Content-Type', 'application/json'); 
xhr.send(); 
> 結果 一つのデータが表示される

コメント

このブログの人気の投稿

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2021-04-30 23:37:32 RSSフィード2021-04-30 23:00 分まとめ(42件)

投稿時間:2023-02-05 02:09:04 RSSフィード2023-02-05 02:00 分まとめ(9件)