from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from src.classes import product_classes from src import data_connection app = FastAPI() origins = [ "*" #Will become something like 'shop.yarnecoppens.com' ] app.add_middleware( CORSMiddleware, allow_origins=origins, allow_credentials=False, allow_methods=["*"], allow_headers=["*"], ) @app.get("/") def read_root(): return {"Hello": "World"} @app.get("/products", response_model=list[product_classes.Product]) def get_all_products(): return data_connection.get_all_products() # @app.get("/boardgames/{boardgame_id}", response_model=boardgame_classes.BoardGame) # def get_boardgame_by_id(boardgame_id: int): # requested_boardgame: boardgame_classes.BoardGame = data_connection.get_boardgame(boardgame_id) # return requested_boardgame