How to pass multiple get parameters in my lambda function?

m b :

I have multiple GET parameters so how should i pass in lambda function and how would my serverless.yml look like.Currently below is the configuration

serverless.yml

myFunc:
    handler: com.mcm.in.MyHandler
    events:  
     - http:
         path: user
         method: get
         cors: true 

Request:/mylist?page=1&size=10&filter=userId=abc&sort=-userId&version=1554304254262

Also how should i call in sls invoke local?

I have tried without the params,It's not working in serverless

Deiv :

You can create a request template that will map your request contents using the parameters, as noted in the documentation. Your function will look something like this (if you want to take in the page parameter for example:

myFunc:
    handler: com.mcm.in.MyHandler
    events:
     - http:
         path: user
         method: get
         cors: true
         integration: lambda
         request:
             template:
                 application/json: '{ "page" : "$input.params(''page'')" }'

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=150343&siteId=1