Last active
January 23, 2020 14:18
-
-
Save meyer1994/fa33730d2becf06e8ca18ba5fef3ad37 to your computer and use it in GitHub Desktop.
Flask in AWS Lambda
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, request, jsonify | |
app = Flask(__name__) | |
@app.route('/ping', methods=['GET']) | |
def ping(): | |
return "pong" | |
@app.route('/echo', methods=['POST']) | |
def echo(): | |
json = request.get_json() | |
return jsonify(json) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service: flasktest | |
provider: | |
name: aws | |
runtime: python3.8 | |
plugins: | |
- serverless-wsgi | |
- serverless-python-requirements | |
package: | |
include: | |
- '!./**' | |
- './api.py' | |
exclude: | |
- '**' | |
functions: | |
api: | |
handler: wsgi_handler.handler | |
events: | |
- http: ANY /{path} | |
custom: | |
wsgi: | |
app: api.app |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment