Application entrypoint

Every application, web or otherwise, needs a primary entry point. In our case, we'll use handler.py to begin application execution when a Lambda function is invoked. Serverless Framework applications will generate a handler.py file when you bootstrap a new project, so this pattern should be familiar to anyone who has used Serverless before. If you've never worked with the Serverless Framework, what follows will be a thorough introduction:

import sys from pathlib import Path # Munge our sys path so libs can be found CWD = Path(__file__).resolve().cwd() / 'lib' sys.path.insert(0, str(CWD)) import simplejson as json from cupping.handlers.session import ( handle_session, handle_session_detail, ) from cupping.exceptions ...

Get Serverless Design Patterns and Best Practices now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.