How to run the code
- Run
pip-compile requirements.in
to createrequirements.txt
fromrequirements.in
. - Run
pip install -r requirements.txt
to install the dependencies. - Run
uvicorn main:app --reload --port 8000
to start the ASGI server and runmain.py
withapp
as the FastAPI instance.--reload
is for auto-reloading the server when the code changes.
How to test
- Get Postman API Platform to test out the webhook.
- Start the server with
uvicorn main:app --reload --port 8000
. - Create a new request in Postman using
http://127.0.0.1:8000/webhook
as the URL andPOST
as the method. Click on Body, and select raw, and then enter one of the payloads in the payloads directory.
aws ecr get-login-password --region us-west-1 | docker login --username AWS --password-stdin 948023073771.dkr.ecr.us-west-1.amazonaws.com
docker build -t fastapi-demo .
docker tag fastapi-demo:latest 948023073771.dkr.ecr.us-west-1.amazonaws.com/fastapi-demo:latest
docker push 948023073771.dkr.ecr.us-west-1.amazonaws.com/fastapi-demo:latest
docker run -p 9000:8080 fastapi-demo
aws ecr get-login-password --region us-west-1 | docker login --username AWS --password-stdin 948023073771.dkr.ecr.us-west-1.amazonaws.com