dimanche 20 janvier 2019

integration lambda function or split lambda per api gateway http codes

I'm setting up a aws-apigateway-lambda and i'm new in that services.

I'm Wondering that how to use lambda getting individual methods(POST,GET...)?

For instances,

  1. Create Individual lambda function per http method.

GET api.com -> lambda.api.get

POST api.com -> lambda.api.post

  1. one lambda function and Accept all method
  1. GET,POST,DELETE... api.com -> lambda.api
def lambda_function(event,context):
    method = event["http-method"]
    if method == 'GET': return receive_get()
    elif method == 'POST': return receive_post()

which is efficient way ??

Aucun commentaire:

Enregistrer un commentaire