https://github.com/alexander784/recipe_api
A RESTful API developed on Django,the API allows users to manage recipes by executing CRUD
https://github.com/alexander784/recipe_api
api django django-application django-rest-framework sqlite
Last synced: 4 months ago
JSON representation
A RESTful API developed on Django,the API allows users to manage recipes by executing CRUD
- Host: GitHub
- URL: https://github.com/alexander784/recipe_api
- Owner: alexander784
- License: mit
- Created: 2024-08-27T10:21:18.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-27T12:30:12.000Z (almost 2 years ago)
- Last Synced: 2025-01-31T23:04:44.488Z (over 1 year ago)
- Topics: api, django, django-application, django-rest-framework, sqlite
- Language: Python
- Homepage:
- Size: 17.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Recipe API
Introduction
This is a RESTful API developed on Django, a strong Python web framework, with SQlite as the database backend. The API allows users to manage recipes by executing CRUD (Create, Read, Update, and Delete) activities on them. Each recipe contains a title and a description.
## Features
Create a new recipe with title and description.
Retrieve a list of all recipes.
Retrieve details of a specific recipe by its ID.
Update an existing recipe title and/or description.
Delete recipe by its ID.
## Technologies Used:
** Django: A high-level web framework written in Python
** Django REST framework: A powerful and flexible toolkit for building Web APIs in Django.
Python: The programming language used for backend development.
Git: Version control system for tracking changes in source code.
## Setup and Installation
To run the recipe API locally on your machine, follow these steps:
1. Ensure you have Python and pip installed. If not, refer to the prerequisites in the documentation.
2. Clone this repository to your local machine:
git clone `https://github.com/alexander784/Recipe_API.git`
3.
Create and activate a virtual environment:
`python -m venv env`
`# On Windows:`
`. env/Scripts/activate`
`# On macOS/Linux:`
`source env/bin/activate`
4. Install the required dependencies:
`pip install -r requirements.txt`
5. Confirm SQlite database configurations:
`DATABASES = {`
`'default': {`
`'ENGINE': 'django.db.backends.``sqlite3',`
`'NAME': BASE_DIR / 'db.``sqlite3',`
`}`
`}`
1. Apply database migrations:
`python3 manage.py makemigrations`
`python3 manage.py migrate`
2. Run the development server:
`python3 manage.py runserver`
The API should be accessible at: http://127.0.0.1:8000/recipe_app/
# API End points
The following are the Recipe API Endpoints:
## Request and Response Format
The API accepts and returns data in JSON format.
`{`
`"title": "recipe title",`
`"description": "Describe the recipe."`
`}`
Response format (GET and POST):
`{`
`"id": 1,`
`"name": "recipe title",`
`"description": "Description of the recipe."`
`}`
## API Usage:
1. Get list of all recipes:
`GET http://127.0.0.1:8000/recipe_app/`
2. Create new recipe
`POST http://127.0.0.1:8000/recipe_app/`
`{`
`"title": "Pilau",`
`"description": "Boil water for about ten minutes."`
`}`
3. Get details of a specific recipe by ID:
`GET http://127.0.0.1:8000/recipe_app/1/`
4. Update an existing recipe by ID:
`PUT http://127.0.0.1:8000/recipe_app/1/`
`{`
`"name": "Pilau masala",`
`"description": "Pilau spices"`
`}`
5. Delete a recipe by ID:
`DELETE http://127.0.0.1:8000/recipe_app/1/`
##
Author: Alexander Nyaga.
## License
This project is licensed under MIT License.