2.3 KiB
MealsAPI
This is a simple solution for a job application homework.
Assignment
We have meals which has name, price, ingredients, spicy, vegan, gluten free, description, kcal, (optionally picture is nice to have). Please create a rest API service running in Kubernetes for CRUD operations executed on meals. Authentication is nice to have, not mandatory. HA solution is also nice to have. We need a helm chart, source (in tgz or zip), readme.md how to start this service, some example curl calls. Please implement also unit tests, so we can see that the provided solution works. Please use Postgresql to store meals. Please fill the database with your favorite meals. Concentrate on to provide a working solution. Implementation language can be either python, go or java.
Running
In order to test or try out MealsAPI you first need to run it. It can be as simple as installing it's dependencies in a Python virtual environment.
python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt
After installing every dependency the app may be started inside the source directory (mealapi).
python3 app.py
An alternative is using the provided Docker Compose manifest.
docker-compose up
Testing
Testing may be done with Postman or newman.
There are two collections provided in the root folder of this project. The HOST environment variable needs to be set correctly in order to run the collections.
Populating the application with example data may be with the LoadExampleData collection. This may be ran with the following newman command.
newman run --env-var "HOST=127.0.0.1:8080" LoadExampleData.postman_collection.json
Testing the behaviour of the application can be done with the MealHomeWork collection. This may be ran with the following newman command.
newman run --env-var "HOST=127.0.0.1:8080" MealHomeWork.postman_collection.json
Helm chart
The helm chart part of the assignment is in the helmchart foler. It can be installed with the following command.
helm install mealapi ./helmchart
This commands should be ran from the root folder of this project. The Postgres deployment requires a storage provider backend (such as Longhorn)