Skip to content

Commit 304202e

Browse files
committed
updating readme
1 parent 7ce5f3e commit 304202e

File tree

9 files changed

+48
-191
lines changed

9 files changed

+48
-191
lines changed

.circleci/config.yml

Lines changed: 0 additions & 113 deletions
This file was deleted.

README.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,44 @@
1-
# Serverless FastApi
1+
# Simple Serverless FastApi Example
2+
3+
A simple serverless [FastAPI](https://fastapi.tiangolo.com/) application using [Mangum](https://pypi.org/project/mangum/) to run on an AWS [Lambda](https://aws.amazon.com/lambda/).
4+
5+
## Complete Walkthrough
6+
7+
### [Simple Serverless FastAPI with AWS Lambda Complete Walkthrough](https://www.deadbearcode.com/simple-serverless-fastapi-with-aws-lambda/)
8+
9+
## Installation
10+
11+
### Setup Virtual Environment
12+
13+
```shell
14+
virtualenv -p python3.7 env
15+
source ./env/bin/activate
16+
```
17+
18+
### Install Dependencies
19+
20+
```shell
21+
pip install -r requirements.txt
22+
```
23+
24+
## Run the application
25+
26+
```shell
27+
uvicorn app.main:app --host 0.0.0.0 --port 8080 --reload
28+
```
29+
30+
## Deploy
31+
32+
### Package Dependencies
33+
34+
```shell
35+
cd env/lib/python3.7/site-packages
36+
zip -r9 /path/to/root/function.zip
37+
```
38+
39+
### Package Lambda
40+
41+
```shell
42+
cd /path/to/root
43+
zip -g function.zip lambda_function.py
44+
```

app/api/api_v1/endpoints/users.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
@router.get("/")
66
async def root():
7-
return {"message": "Users!"}
7+
return {"message": "Get Users!"}

app/core/__init__.py

Whitespace-only changes.

app/core/config.py

Lines changed: 0 additions & 14 deletions
This file was deleted.

app/main.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
from fastapi import FastAPI
22

33
from app.api.api_v1.api import router as api_router
4-
from app.core.config import settings
54
from mangum import Mangum
65

76
app = FastAPI()
87

98

109
@app.get("/")
1110
async def root():
12-
return {"message": f"Secret Key: {settings.SECRET_KEY}"}
11+
return {"message`": "Hello World!"}
1312

1413

15-
app.include_router(api_router, prefix=settings.API_V1_STR)
16-
handler = Mangum(app)
14+
app.include_router(api_router, prefix="api/v1")
15+
handler = Mangum(app)

app/tests/__init__.py

Whitespace-only changes.

app/tests/test_main.py

Lines changed: 0 additions & 11 deletions
This file was deleted.

requirements.txt

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +0,0 @@
1-
aiofiles==0.5.0
2-
aniso8601==7.0.0
3-
async-exit-stack==1.0.1
4-
async-generator==1.10
5-
attrs==19.3.0
6-
certifi==2020.6.20
7-
chardet==3.0.4
8-
click==7.1.2
9-
dnspython==2.0.0
10-
email-validator==1.1.1
11-
fastapi==0.60.1
12-
graphene==2.1.8
13-
graphql-core==2.3.2
14-
graphql-relay==2.0.1
15-
h11==0.9.0
16-
httptools==0.1.1
17-
idna==2.10
18-
importlib-metadata==1.7.0
19-
iniconfig==1.0.1
20-
itsdangerous==1.1.0
21-
Jinja2==2.11.2
22-
mangum==0.9.2
23-
MarkupSafe==1.1.1
24-
more-itertools==8.4.0
25-
orjson==3.3.0
26-
packaging==20.4
27-
pluggy==0.13.1
28-
promise==2.3
29-
py==1.9.0
30-
pydantic==1.6.1
31-
pyparsing==2.4.7
32-
pytest==6.0.1
33-
python-dotenv==0.14.0
34-
python-multipart==0.0.5
35-
PyYAML==5.3.1
36-
requests==2.24.0
37-
Rx==1.6.1
38-
six==1.15.0
39-
starlette==0.13.6
40-
toml==0.10.1
41-
typing-extensions==3.7.4.2
42-
ujson==3.0.0
43-
urllib3==1.25.10
44-
uvicorn==0.11.6
45-
uvloop==0.14.0
46-
websockets==8.1
47-
zipp==3.1.0

0 commit comments

Comments
 (0)