Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import json
import uuid
GET_RAW_PATH = "/getPerson"
CREATE_RAW_PATH = "/createPerson"
def lambda_handler(event, context):
if event['rawPath'] == GET_RAW_PATH:
print('Received getPerson request')
personId = event['queryStringParameters']['personId']
print("with param personId=" + personId)
return { "firstName": "Daniel " + personId, "lastName": "G", "email": "" }
elif event['rawPath'] == CREATE_RAW_PATH:
print('Received createPerson request')
decodedBody = json.loads(event['body'])
firstname = decodedBody['firstname']
print('with param firstname=' + firstname)
return { "personId": str(uuid.uuid1())}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment