Updated version of the recipe-app-api.
New version includes:
- Django 4 instead of Django 2
- GitHub Actions replacing Travis-CI
- This project have been deployed on AWS
- Automated documentation feature using Swagger
After downloading the project - create a virtual environment:
python -m venv venv
pip install -r requirements.txt
Build app and database containers:
docker-compose build
To check and test the Swagger API documentation go to the url
:
http://127.0.0.1:8000/api/docs/
App is using token authentication. To use the recipe app you must have a user with its own token.
http://127.0.0.1:8000/api/user/create/
After you create a user pass your data to get the token. Use it through the app to get access to the endpoints.
http://127.0.0.1:8000/api/user/token/
http://127.0.0.1:8000/api/user/me/
You can update your email, password, and name.
http://127.0.0.1:8000/api/recipe/tags/
http://127.0.0.1:8000/api/recipe/ingredients/
http://127.0.0.1:8000/api/recipe/recipes/
http://127.0.0.1:8000/api/recipe/recipes/id/
Where id
is the id of the recipe. Example:
http://127.0.0.1:8000/api/recipe/recipes/1/
This endpoint for the recipe with the id=1
.
Each recipe can have an image. To upload it go to the url
:
http://127.0.0.1:8000/api/recipe/recipes/id/upload-image/
As in the detail view, you should pass the id
to upload an image for the specific recipe. Example:
http://127.0.0.1:8000/api/recipe/recipes/1/upload-image/
Upload an image for the recipe with id=1
.
http://127.0.0.1:8000/api/recipe/recipes/?tags=tag_id&ingredients=ingredient_id
Recipe include tag with id=tag_id
and ingredient with id=ingredient_id
. Example:
http://127.0.0.1:8000/api/recipe/recipes/?tags=2&ingredients=1
If you want to see only assigned tags for recipes just set ?assigned_only=1
in the url as a parameter. Example:
http://127.0.0.1:8000/api/recipe/tags/?assigned_only=1
Not assigned only:
http://127.0.0.1:8000/api/recipe/tags/?assigned_only=0
Same with ingredients. Examples:
http://127.0.0.1:8000/api/recipe/ingredients/?assigned_only=1
http://127.0.0.1:8000/api/recipe/ingredients/?assigned_only=0
docker-compose run --rm app sh -c "python manage.py test"