/drf-pizza-api

Simple Pizza API using DRF

Primary LanguagePython

Overview

You have to create a Django application which should be able to store information about different types of Pizza, then create an API interface that lists the information about all the different stored pizzas, and also be able to interact with that information (such as edit or delete).

Database

MongoDB should be configured with the project. Our database should be able to store information about Pizza, following are the details :

  • A Pizza can be of multiple types : Regular or Square
  • A Pizza can be of multiple sizes : Small, Medium, Large, etc. (These are just examples, the user should be allowed to add any other size at any point of time)
  • A Pizza can consist of many toppings out of the following (Onion, Tomato, Corn, Capsicum, Cheese, Jalapeno etc.), the choice of toppings should not be limited to the ones mentioned above, the user should be allowed to add any type of topping at any point of time)

API

  • Create an API endpoint to create regular pizza and a square pizza.
  • Create an API endpoint which lists the information about all the stored pizza, the response of this should also contain the information about the toppings, size and type of Pizza.
  • Allow filtering the list of pizza returned by the API based on Size & Type of Pizza.
  • Create an API endpoint that allows the user to edit or delete any pizza from the database.

Errors & Validation

  • The API should return proper 40x codes when any kind of wrong input is sent to the API, the server should not return 500 errors

  • The user should not be able to create a pizza of any other type except Regular and Square.

  • The user should not be able to create pizza of size which isn't present in the database.


Requirements for running project

NOTE: If running on windows please use git-bash don't use cmd.

Steps to run the project:

git clone https://github.com/rishank-shah/drf-pizza-api.git
cd drf-pizza-api
cp .env.example .env
Fill the .env file with the correct database name
virtualenv venv 
source venv/bin/activate
pip install -r requirements.txt
source .env
python manage.py migrate
python manage.py runserver

If all commands run successfully API will be running on PORT 8000 on localhost

http://localhost:8000 Check below for API Endpoints


Api Endpoints:

GET

POST

PUT

DELETE