Skip to content

Instantly share code, notes, and snippets.

@beabetterdevv
Created May 30, 2021 00:13
Show Gist options
  • Save beabetterdevv/3373fe357bc8156ef28b722044e1dc29 to your computer and use it in GitHub Desktop.
Save beabetterdevv/3373fe357bc8156ef28b722044e1dc29 to your computer and use it in GitHub Desktop.
CODE
---
import json
import uuid
GET_RAW_PATH = "/getPerson"
CREATE_RAW_PATH = "/createPerson"
def lambda_handler(event, context):
print(event)
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": "myEmail@gmail.com" }
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())}
@joegittingherdone
Copy link

Thank you for your tutorial video(s). "firstname" is in camel case in your video, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment