The Open API Initiative thanks the API Tokyo Meetup for including them in discussions and is pleased with the positive response received from the API community. They encourage contributing to the OpenAPI Specification on GitHub and following them on social media, and enjoy hearing about projects using the OAS.
This document describes Amazon Web Services (AWS) API Gateway and how it can be used to create, publish, maintain, monitor, and secure APIs at any scale. API Gateway sits between the internet and AWS services such as Lambda, EC2, DynamoDB, and supports many features including caching, authorization, throttling, monitoring, and transformations. It allows defining RESTful APIs and WebSocket APIs that make AWS services programmatically accessible to developers building mobile, web, and IoT applications.
43. API Gateway+LambdaでSlow Mock
Slow Mockの作り方
console.log('Loading function');
exports.handler = function(event, context) {
console.log('before =', new Date().getTime());
var time = 3000;
var d1 = new Date().getTime();
var d2 = new Date().getTime();
while (d2 < d1 + time) {
d2 = new Date().getTime();
}
console.log('after =', new Date().getTime());
context.succeed("Success");
};
簡単に作るのであれば、LambdaでSleepするだけ。
API GatewayでMockを返す。
真面目に作るのであれば、引数・返却値を返すようにする