Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I access a POST parameter in Node js AWS Lambda with API Gateway integration?

I know how to access GET string variables in a Node js Lambda that is integrated with API Gateway with:

 event["queryStringParameters"]["variable_name"]

What is the equivalent for accessing POST variables?

like image 327
jaimerr Avatar asked Mar 15 '18 10:03

jaimerr


1 Answers

Use the following

if (event.body !== null && event.body !== undefined) {
        let body = JSON.parse(event.body) //use in case of JSON body
        //your code
}

AWS Documentation

like image 102
Sandeep Singh Avatar answered Sep 21 '22 08:09

Sandeep Singh