-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp_handler.py
More file actions
25 lines (21 loc) · 763 Bytes
/
app_handler.py
File metadata and controls
25 lines (21 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import psycopg2
import json
def handler(event, context):
print(event)
if request_method == 'POST':
body = event.get('body')
elif request_method == 'GET':
query_params = event.get('queryStringParameters')
return {
'statusCode': 200,
'headers': {
'Access-Control-Allow-Headers': 'Content-Type',
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'OPTIONS,POST,GET',
'Content-Type': 'application/json',
},
'body': '{"status":"test success"}'
if __name__ == "__main__":
# FOR LOCAL TESTING ONLY
event = {'httpMethod': 'GET', 'queryStringParameters': 'none'}
print(handler(event,{}))