This app was build using Fastapi
Please refer to Test_report.pdf for code discussion / case studies / empirical studies and performance bencharmking.
First, you should install necessary requirements, by typing:
pip install -r requirements.txt
To run the api, type this command:
uvicorn src.api:app --reload
Then you can just run the api by sending request to the following url
http://127.0.0.1:8000/api/smart/<timeout_param>
To run the tests, type this command:
pytest
To run this project with docker, you'll need to have Docker installed.
Build the container, providing a tag:
docker build -t fastapi-image .
Then you can run the container, passing in a name for the container, and the previously used tag:
docker run -p 8000:8000 --name fastapi_app fastapi-image
Then you can just run the api by sending request to the following url
http://127.0.0.1:8000/api/smart/<timeout_param>
Note that if you used the code as-is with the --reload
option that you won't be able to kill the container using CTRL + C
.
Instead in another terminal window you can kill the container using Docker's kill command:
docker kill fastapi_app
Notes:
docker ps -a
- see all containers
docker start fastapi_app
- start container
docker stop fastapi_app
- stop container
docker rm -f $(docker ps -a -q)
- delete all containers
docer image ls
- see all images
docker run -p 8000:8000 --name fastapi_app fastapi-image
- after being sure the image is not run in any container