The innovative -----yummy recipes app----- is an application that -----allows users to create, save and share ----- meeting the needs of -----keeping track of awesome food recipes-----.
- Python3.6: Python is a programming language that lets you work quickly and integrate systems more effectively
- Django 1.11: Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
- Django REST framework: Django REST framework is a powerful and flexible toolkit for building Web APIs
- Django REST framework JWT: Django REST framework JWT This package provides JSON Web Token Authentication support for Django REST framework.
- Django REST Swagger: Django REST Swagger An API documentation generator for Swagger UI and Django REST Framework.
- Postgresql: PostgreSQL is a powerful, open source object-relational database system.
- Pipenv: Pipenv is a tool that aims to bring the best of all packaging worlds (bundler, composer, npm, cargo, yarn, etc.) to the Python world.
- Psycopg2: Psycopg is the most popular PostgreSQL adapter for the Python programming language.
$ git clone https://github.com/PatrickCmd/django-rest-api-yummy-recipes.git
$ cd django-rest-api-yummy-recipes
$ pip install pipenv
$ pipenv shell
$ pipenv install
Execute the commands in the terminal/console as stated below
Follow the Link on how to download and install postgres(>=10) on windows platform
Create Database
$ psql -U postgres
$postgres# CREATE DATABASE {dbname}; Where dbname is the database name
Setup Database URL environment variable
$ SET DB=postgres
$ SET DB_NAME={dbname} Where dbname is the database name for the postgres instance
$ SET DB_USER={dbuser} Where dbuser is the database user for the postgres instance
Install postgres
MAC Users
$ brew install postgres
Follow the link on how to setup brew if not yet installed
Ubuntu users
Follow the Link on how to setup and install postgres(>=10) on Ubuntu-linux platform
Create Database
$ psql -U postgres
$ postgres# CREATE DATABASE {dbname}; Where dbname is the database name
Setup Database URL environment variable
$ export DB=postgres
$ export DB_NAME={dbname} Where dbname is the database name for the postgres instance
$ export DB_USER={dbuser} Where dbuser is the database user for the postgres instance
$ python manage.py runserver_plus
Execute the url localhost:8000/api in your browser
Execute this command at the terminal
$ python manage.py test
Endpoint | Functionality | Access |
---|---|---|
POST /auth/users/register | Registers a user | PUBLIC |
POST /auth/users/login | Logs a user in | PUBLIC |
GET /auth/users | List registered users | PUBLIC |
POST /api/categories | Creates a new recipe category | PRIVATE |
GET /api/categories | Lists all created recipe categories | PRIVATE |
GET /api/categories/{id} | Gets a single recipe category with the suppled id | PRIVATE |
PUT /api/categories/{id} | Updates recipe category with the suppled id | PRIVATE |
DELETE /api/categories/{id} | Deletes recipe_category with the suppled id | PRIVATE |
POST /api/recipes | Creates a new recipe | PRIVATE |
GET /api/recipes | List all recipes | PRIVATE |
PUT /api/recipes/{id} | Updates a recipe item | PRIVATE |
DELETE /api/recipes/{id} | Deletes arecipe in a recipe category | PRIVATE |
GET /api/categories/{category_pk}/recipes | GET recipes in a category | PRIVATE |
POST /api/categories/{category_pk}/recipes | Create recipes in a category | PRIVATE |
GET /api/categories/{category_pk}/recipes/{id} | GET single recipe in a category | PRIVATE |
PUT /api/categories/{category_pk}/recipes/{id} | Update a recipe in a recipe category | PRIVATE |
DELETE /api/categories/{category_pk}/recipes/{id} | Deletes a recipe in a recipe category | PRIVATE |
GET /api/public-recipes/ | GET public recipes | PUBLIC |
GET /api/public-recipes/{id} | GET a single public recipe | PUBLIC |
GET /api/public-recipes/{id}/reviews | GET posted reviews for a single public recipe | PUBLIC |
POST /api/public-recipes/{id}/reviews | Created a review for a single public recipe | PUBLIC |
GET /api/public-recipes/{id}/upvotes | GET upvotes for a single public recipe | PUBLIC |
POST /api/public-recipes/{id}/upotes | Up-vote for a single public recipe | PRIVATE |
Visit the links below for the API documentation
Swagger Documentation Login with username: normaluser password: normaluser1234 for complete swagger-docs
Vist this Link for the live application.