Docs
Code Structure

Handler Method

The handler method is the entry point for your serverless function. It receives an HTTP request and returns an HTTP response. The function signature is:

def handler(request):
  return response

To add additional methods, you need to define them outside of the handler function, and then call them from within the handler function. Here's an example:

import json
 
def convert_to_json_string(data):
  return json.dumps(data)
 
def handler(request):
    data = request['body'].get('message')
    json_string = convert_to_json_string(data)
    return json_string