- Install dependencies with
pip install -r requirements.txt
- Start with
uvicorn src.main:app --port 8080
After running the project, Swagger will be available on http://localhost:8080/docs
This endpoint doesn't take any queries/payload and is only useful for automated checks to know if the service is alive.
The payload must be a json object with a list of words for the vowels to be counted.
- The
words
value must be a list of valid strings- At least one string is required
- Strings cannot contain characters with an ASCII code below 0 or above 255
- Null values are not permitted
{
"words": ["batman", "robin", "coringa"]
}
The response is a json object in the structure word: vowels_count
.
{
"batman": 2,
"robin": 2,
"coringa": 3
}
The payload must be a json object with a list of words to be sorted, and the sort orientation.
- The
words
value must be a list of valid strings- At least one string is required
- Strings cannot contain characters with an ASCII code below 0 or above 255
- Null values are not permitted
- The
order
value must be either "asc" or "desc"
{
"words": ["batman", "robin", "coringa"],
"order": "asc"
}
The response is a json array with the sorted values.
["batman", "coringa", "robin"]
After installing dependencies, run pytest
.
The linter will run automatically in a pre-commit hook.
Deployment is done using Kamal. The process works by building a Docker image(see Dockerfile) and publishing it to Dockerhub. Kamal then accesses the host using SSH, pulls the image and does a zero-downtime deployment.
This repository is configured to deploy whenever a commit is pushed to the main branch and that's done using a GitHub actions workflow that runs the linter(Ruff) and tests(Pytest) before deploying.
Deploying requires two credentials: Dockerhub token and the private key to access the host machine. Both are securely stored in this repository secrets.