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 [email protected]:jllopez/basic-restapi-app.git
- Run the application
make run
This command will remove any existing
fastapi_restapp
containers and build a newdev/fastapi_restapp
image.
- Visit URL
http://localhost:8080/docs#/
User
admin/admin
is 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 dev
This command will remove any existing
fastapi_restapp
containers, build a newdev/fastapi_restapp
image, start a container, mount local code under/opt/app
and provide a/bin/bash
terminal.
- Start uvicorn server by executing the following command in the container's terminal
uvicorn app.main:app --host 0.0.0.0 --port 8080 --reload
Now 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.