LoginSignup
0
0

More than 5 years have passed since last update.

AWS Lambda 関数のリクエスト

Posted at

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();

> 結果 一つのデータが表示される

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0