简体   繁体   中英

How can I get common response format for Lambda API?

I am using Node.js for AWS Lambda + API Gateway APIs.

I have multiple Lambda functions and each giving different response formats as it integrated multiple third party SDKs like Stripe/DynamoDB and all.

Is there any way to get common response for all the functions like below?

{
  "success" : true,
  "data" : { RESPONSEFROMLAMBDA },
  "messages" : null,
  "code" : 200,
  "description" : "OK"
}

The third-party services your Lambda functions are using shouldn't have any bearing on the response format. You just need to update all the API Gateway endpoints to use a mapping template with this format.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM