Python 3.11.4
NodeJS 18.15.0
For Backend (http://localhost:8000/)
cd backend
python3 -m venv env
source env/bin/activate
pip install -r requirements.txt
Note: Current DB is SQLite (if want to change, follow this https://docs.djangoproject.com/en/4.2/ref/settings/#databases)
python manage.py migrate
python manage.py loaddata fixture/data.json
python manage.py test
python manage.py runserver
Create a new order for a specific food item from the ice cream truck.
URL:
http://localhost:8000/api/order/
Args:
food_item_type_id: Food Item Type ID
quantity: quantity
flavor_id: Flavor ID (optional for food item that doesnot have flavor)
truck_id: Truck ID
Returns:
"ENJOY!": if buy in stock amount of food
"SORRY!": if buy out of stock amount of food
"UNAVAILABLE!": if buy unavailable food
Get details of a specific ice cream truck, including its food items and total earnings.
URL:
http://localhost:8000/api/truck/<pk>
Args:
pk (int): The primary key of the truck to retrieve details.
Returns:
A JSON response with the truck's details.
"""
Get truck list
URL:
http://localhost:8000/api/truck/
Returns:
A JSON response with the truck list.
"""
Get flavor list
URL:
http://localhost:8000/api/flavor/
Returns:
A JSON response with the flavor list.
"""
Get truck list
URL:
http://localhost:8000/api/food-item-type/
Returns:
A JSON response with the food item type list.
For Frontend (http://localhost:3000/)
cd frontend
npm install
npm run dev