First, we need to implement our application logic. The code will be very straightforward and I won't cover the details. Everything can be implemented in a mere 42 lines of Python code:
import jsonimport sysfrom pathlib import Path# Munge our sys path so libs can be foundCWD = Path(__file__).resolve().cwd() / 'lib'sys.path.insert(0, str(CWD))import requestsdef get_users(event, context): user_response = requests.get('https://jsonplaceholder.typicode.com/users') users = {} for user in user_response.json(): users[user['id']] = user post_response = requests.get('https://jsonplaceholder.typicode.com/posts') posts = [] for post in post_response.json(): user = users[post['userId']] posts.append({ "id" : post['id'], ...