Naive solution for a basic REST API application. Its main purpose is to provide an easy way to expose endpoints and enable SDETs to build automation frameworks around it.
The application was designed to run inside a Docker container to strip out the complexity of setting virtual environments, facilitate its distribution and avoid the infamous but it works on my machine conversation.
-
Open a terminal
-
Change to your favorite local directory (i.e.
cd /opt) -
Clone the repository
git clone git@github.com:jllopez/basic-restapi-app.git- Run the application
make runThis command will remove any existing
fastapi_restappcontainers and build a newdev/fastapi_restappimage.
- Visit URL
http://localhost:8080/docs#/User
admin/adminis preloaded in the DB. Leverage this user to authenticate and perform admin-only operations (i.e. create/delete/list-all users, delete comments)
-
Complete steps 1-3 as described in Run the App section.
-
Start development environment
make devThis command will remove any existing
fastapi_restappcontainers, build a newdev/fastapi_restappimage, start a container, mount local code under/opt/appand provide a/bin/bashterminal.
- Start uvicorn server by executing the following command in the container's terminal
uvicorn app.main:app --host 0.0.0.0 --port 8080 --reloadNow the container is ready for development. Local code changes will be automatically reflected inside the container and thanks to the --reload uvicorn flag the code will be immediately deployed.