Skip to content

Instantly share code, notes, and snippets.

@tuergeist
Created November 20, 2021 11:30
Show Gist options
  • Save tuergeist/55d634464851f1f7ad6aba2c72c4717e to your computer and use it in GitHub Desktop.
Save tuergeist/55d634464851f1f7ad6aba2c72c4717e to your computer and use it in GitHub Desktop.
Lamdba envent handler serving an HTML file
from pathlib import Path
def handler_name(event, context):
with Path('web/index.html').open() as file:
html = file.read()
response = {
"statusCode": 200,
"body": html,
"headers": {
'Content-Type': 'text/html',
}
}
return response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment