toddler_shop_api/src/main.py

18 lines
583 B
Python
Raw Normal View History

2024-08-04 08:43:04 +02:00
from fastapi import FastAPI
from src.classes import product_classes
from src import data_connection
2024-08-04 08:43:04 +02:00
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
@app.get("/products", response_model=list[product_classes.Product])
2024-08-04 08:47:49 +02:00
def get_all_products():
return data_connection.get_all_products()
2024-08-04 08:47:49 +02:00
# @app.get("/boardgames/{boardgame_id}", response_model=boardgame_classes.BoardGame)
2024-08-04 08:43:04 +02:00
# def get_boardgame_by_id(boardgame_id: int):
# requested_boardgame: boardgame_classes.BoardGame = data_connection.get_boardgame(boardgame_id)
# return requested_boardgame