Serverless Framework

Introduction

  • The Serverless Framework helps you develop and deploy AWS Lambda functions, along with the AWS infrastructure resources they require.

npm i serverless -g

Examples - Python

Code

app.py
def post_genkb_page(event:dict , context:dict):
    try:
        # listen to the event
        print("post genkb page raw event", event)
        input = SharePointMigrationInput(**json.loads(event.get("body",{})))
        print("input", input)
        # execute the logic
        res = asyncio.run(execute_post_genkb_page(input))
        print("res", res)
        # return res, must be followed as statusCode and body
        return {
            'statusCode': 200,
            'body': json.dumps(asdict(res))
        }
    except Exception as e:
        print("posting from sharepoint to genkb error", e)
        return {
            'statusCode': 400,
            'body': str(e)
        }

Deployment Setting

Examples - NodeJS

Code

Deployment Setting

Last updated

Was this helpful?