pyBegin / projects / restrauntapi
🔌

Restraunt_API

The Restaurant API consists of: adding items to the menu, viewing the menu, searching for menu items based on a string, creating orders, and displa…

23 lines🖥 Desktop only

Restraunt_API

The Restaurant API consists of: adding items to the menu, viewing the menu, searching for menu items based on a string, creating orders, and displaying previous orders for a user.

Add to Menu:

View Menu:

Both the "Add to Menu" and "View Menu" functions are implemented using a single endpoint with POST and GET methods, respectively.

Search Menu Based on String:

Create Order:

View Past Orders:

Example

Add a menu item (POST):

POST http://127.0.0.1:8000/menu/
Body: { "Item_name": "Margherita Pizza", "price": 12.99 }
→ 201 Created

View the full menu (GET):

GET http://127.0.0.1:8000/menu/
→ 200 OK
[{"Item_name": "Margherita Pizza", "price": 12.99}, ...]

Search for an item:

GET http://127.0.0.1:8000/menu_item/Margherita Pizza/
→ 200 OK  {"Item_name": "Margherita Pizza", "price": 12.99}

View past orders for a user:

GET http://127.0.0.1:8000/orders/alice@example.com/
→ 200 OK  [{"user": "alice@example.com", "items": [...], "ord_date": "2024-01-15"}]

How to run on localhost

pip install -r requirements.txt
cd Restraunt_API
python manage.py migrate
python manage.py runserver

Dependencies