Writing our logic layer
Since we've covered the overall design and different layers, let's get down to the implementation of our application code.
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 import Http404
CORS_HEADERS = {
'Access-Control-Allow-Origin': '*',
'Access...