The Recipe API is a RESTful service built using Django
and Django REST Framework
. It allows users to create, store, and manage recipes, tags, and ingredients. The API uses token-based
authentication to secure endpoints and PostgreSQL
as the main database.
Prerequisites:
You don't have to install all dependencies on your machine.
All you need to do is to make sure that Docker
is already installed on your machine.
-
Clone the repository:
git clone https://github.com/AGsalamH/recipe-app-api.git cd recipe-api
-
Build docker Image:
docker-compose build .
-
Create a superuser:
docker-compose run --rm django sh -c "python manage.py createsuperuser"
-
Run the development server:
docker-compose up
This API uses token-based authentication. To access most endpoints, you need to include a token in your requests.
To get a token, send a POST request to /users/auth-token/
with your email and password:
POST /api/token/
Request Body:
{
"email": "youremail",
"password": "yourpassword"
}
Response:
{
"token": "yourtoken"
}
Include the token in the Authorization
header of your requests:
Authorization: Token yourtoken
-
Recipes
GET /api/recipes/
- List all recipesPOST /api/recipes/
- Create a new recipeGET /api/recipes/{id}/
- Retrieve a specific recipePUT /api/recipes/{id}/
- Update a specific recipeDELETE /api/recipes/{id}/
- Delete a specific recipe
-
Ingredients
GET /api/ingredients/
- List all ingredientsPOST /api/ingredients/
- Create a new ingredientGET /api/ingredients/{id}/
- Retrieve a specific ingredientPUT /api/ingredients/{id}/
- Update a specific ingredientDELETE /api/ingredients/{id}/
- Delete a specific ingredient
-
Tags
GET /api/tags/
- List all tagsPOST /api/tags/
- Create a new tagGET /api/tags/{id}/
- Retrieve a specific tagPUT /api/tags/{id}/
- Update a specific tagDELETE /api/tags/{id}/
- Delete a specific tag