Skip to content

Commit 158e289

Browse files
committed
Add the deployment method
1 parent 7489232 commit 158e289

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

app.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from flask import Flask
2+
app = Flask(__name__)
3+
4+
5+
@app.route("/cats")
6+
def cats():
7+
return "Cats"
8+
9+
@app.route("/dogs/<id>")
10+
def dog(id):
11+
return "Dog"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"author": "",
1010
"license": "ISC",
1111
"dependencies": {
12-
"serverless": "^2.33.1",
12+
"serverless": "^2.64.1",
1313
"serverless-python-requirements": "^5.1.1"
1414
}
1515
}

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
pytest
1+
pytest
2+
Flask==1.0.2

serverless.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
service: "" # <name> of the service
1+
service: "aws-lambda-python" # <name> of the service
22
provider:
33
name: aws
44
runtime: python3.8
@@ -25,6 +25,11 @@ provider:
2525
# - '/*'
2626

2727
functions:
28+
api:
29+
handler: wsgi_handler.handler
30+
events:
31+
- http: ANY /
32+
- http: ANY /{proxy+}
2833
handler:
2934
handler: handler.handler
3035
timeout: 300
@@ -34,10 +39,13 @@ functions:
3439

3540
plugins:
3641
- serverless-python-requirements
42+
- serverless-wsgi
3743

3844
custom:
3945
pythonRequirements:
4046
dockerizePip: true
47+
wsgi:
48+
app: api.app
4149

4250
# resources:
4351
# Resources:

0 commit comments

Comments
 (0)